therubyracer installation on windows with libv8 installed --with-system-v8 - ruby

I finally got libv8 installed on my windows with
gem install libv8 -- --with-system-v8
now when I am trying to install therubyracer I get
gem install therubyracer
Temporarily enhancing PATH to include DevKit...
Building native extensions. This could take a while...
Building native extensions. This could take a while...
ERROR: Error installing therubyracer:
ERROR: Failed to build gem native extension.
C:/Ruby193/bin/ruby.exe extconf.rb --with-system-v8
checking for main() in -lpthread... no
checking for v8.h... no
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers. Check the mkmf.log file for more
details. You may need configuration options.
Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=C:/Ruby193/bin/ruby
--with-pthreadlib
--without-pthreadlib
--enable-debug
--disable-debug
--with-v8-dir
--without-v8-dir
--with-v8-include
--without-v8-include=${v8-dir}/include
--with-v8-lib
--without-v8-lib=${v8-dir}/
C:/Ruby193/lib/ruby/gems/1.9.1/gems/libv8-3.16.14.3/ext/libv8/location.rb:50:in `configure': You hav
e chosen to use the version of V8 found on your system (Libv8::Location::System::NotFoundError)
and *not* the one that is bundle with the libv8 rubygem. However,
it could not be located. please make sure you have a version of
v8 that is compatible with 3.16.14.3 installed. You may
need to special --with-v8-dir options if it is in a non-standard
location
thanks,
The Mgmt
What I want to know is what this error message really means?
Also I looked this up https://github.com/cowboyd/libv8#bring-your-own-v8
How do I install headers for v8?

When I faced this problem I found that I didn't need those gems in development, because rails use to precompile your assets, so my solution was pretty simple,
Gemfile
gem "rails"
group :production do
gem 'therubyracer'
end
Then when you bundle run this command
$ bundle install --without production
Then smile to the life :D

On Mac you can try updating the v8 library with homebrew:
gem uninstall libv8
brew install v8
gem install therubyracer
Update: Sorry, didn't realize this was a Windows only question.

#Aalap
I ran into the same problem while setting up my Ruby on Rails web application on Windows 7 64-bit. I came across this solution. This is a bit old but solved the problem. This solution provides 'therubyracer' gem file and v8.dll libs to install. The instructions are pretty much clear on the link above.
I installed 'libv8' gem just like Periback's answer on SO and when I tried to install 'therubyracer' gem, it failed with same error as yours. Now my web application is running fine and my "gem list" command shows:
libv8 (3.11.8.13)
therubyracer (0.11.0beta1 x86-mingw32)
Hope this helps.

Related

bundle install doesn't work on with RVM

I have a problem installing my bundle.
These were my last steps:
git clone http:...
git checkout -b daniel
bundle install
The error I got was:
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native
extension.
/Users/daniel/.rvm/rubies/ruby-1.9.3-p286/bin/ruby extconf.rb checking for main() in -lpthread... yes checking for main() in
-lobjc... yes
*** extconf.rb failed *** Could not create Makefile due to some reason, probably lack of necessary libraries and/or headers. Check
the mkmf.log file for more details. You may need configuration
options.
Provided configuration options: --with-opt-dir --without-opt-dir
--with-opt-include --without-opt-include=${opt-dir}/include
--with-opt-lib --without-opt-lib=${opt-dir}/lib --with-make-prog
--without-make-prog --srcdir=. --curdir
--ruby=/Users/daniel/.rvm/rubies/ruby-1.9.3-p286/bin/ruby
--with-pthreadlib --without-pthreadlib --with-objclib
--without-objclib --enable-debug --disable-debug
/Users/daniel/.rvm/gems/ruby-1.9.3-p286/gems/therubyracer-0.11.0/ext/v8/build.rb:50:in
`build_with_rubygem_libv8': undefined local variable or method
`libv8_include_flags' for main:Object (NameError) from
extconf.rb:20:in `<main>'
Gem files will remain installed in
/Users/daniel/.rvm/gems/ruby-1.9.3-p286/gems/therubyracer-0.11.0 for
inspection. Results logged to
/Users/daniel/.rvm/gems/ruby-1.9.3-p286/gems/therubyracer-0.11.0/ext/v8/gem_make.out
An error occurred while installing therubyracer (0.11.0), and Bundler
cannot continue. Make sure that `gem install therubyracer -v '0.11.0'`
succeeds before bundling.
When I tried to run gem install therubyracer -v '0.11.0' I got:
Building native extensions. This could take a while... ERROR: Error
installing therubyracer: ERROR: Failed to build gem native extension.
/Users/daniel/.rvm/rubies/ruby-1.9.3-p286/bin/ruby extconf.rb checking for main() in -lpthread... yes checking for main() in
-lobjc... yes
*** extconf.rb failed *** Could not create Makefile due to some reason, probably lack of necessary libraries and/or headers. Check
the mkmf.log file for more details. You may need configuration
options.
Provided configuration options: --with-opt-dir --without-opt-dir
--with-opt-include --without-opt-include=${opt-dir}/include
--with-opt-lib --without-opt-lib=${opt-dir}/lib --with-make-prog
--without-make-prog --srcdir=. --curdir
--ruby=/Users/daniel/.rvm/rubies/ruby-1.9.3-p286/bin/ruby
--with-pthreadlib --without-pthreadlib --with-objclib
--without-objclib --enable-debug --disable-debug
/Users/daniel/.rvm/gems/ruby-1.9.3-p286/gems/therubyracer-0.11.0/ext/v8/build.rb:50:in
`build_with_rubygem_libv8': undefined local variable or method
`libv8_include_flags' for main:Object (NameError) from
extconf.rb:20:in `<main>'
Gem files will remain installed in
/Users/daniel/.rvm/gems/ruby-1.9.3-p286/gems/therubyracer-0.11.0 for
inspection. Results logged to
/Users/daniel/.rvm/gems/ruby-1.9.3-p286/gems/therubyracer-0.11.0/ext/v8/gem_make.out
I am working on Mac OS 10.7.5. Xcode and its command line tools and Rails are up to date.
SQLite 3 is also installed.
Can anyone help me?
EDIT:
I also tried to delete the repository and to clone it again, with the same errors.
EDIT:
Is the installation path of Rails and Sqlite3 correct?
daniel:~
daniel$ sudo gem update --system Latest version currently
installed. Aborting.
daniel:~
daniel$ sudo gem install rails
Fetching:
rails-3.2.11.gem (100%) Successfully installed
rails-3.2.11 1 gem installed
Installing ri documentation for rails-3.2.11...
Installing RDoc documentation for rails-3.2.11...
daniel:~
daniel$ sudo gem install sqlite3
Fetching: sqlite3-1.3.7.gem (100%)
Building native extensions. This could take a while...
Successfully installed sqlite3-1.3.7 1 gem installed
Installing ri documentation for sqlite3-1.3.7...
Installing RDoc documentation for sqlite3-1.3.7...
daniel:~
daniel$ which ruby irb gem rake
/Users/daniel/.rvm/rubies/ruby-1.9.3-p286/bin/ruby
/Users/daniel/.rvm/rubies/ruby-1.9.3-p286/bin/irb
/Users/daniel/.rvm/rubies/ruby-1.9.3-p286/bin/gem
/Users/daniel/.rvm/gems/ruby-1.9.3-p286/bin/rake
At least one problem is that you are running RVM, but used sudo to install gems on your system.
Read "RVM and RubyGems", especially the part that says:
"DO NOT use sudo..."
RVM creates a sandbox for you, the user, in your own user-space on a machine, that allows you to manage it without needing to be the system administrator. In other words, that means you don't have to use sudo for any RVM or gems management.
If you do use sudo, you temporarily cease being you, the user, and become the administrator, with administrator privileges and the administrator's environment, which does NOT include the RVM sandbox in your /Users/daniel/.rvm/rubies/ruby-1.9.3-p286 path. Knowledge of the sandbox is carried by the PATH in your environment, which the root on your machine doesn't use. Gems installed inside that sudo sub-shell get installed into the location that the administrator account knows about, which is inside the System Ruby installation, which is why your RVM sandboxed Ruby doesn't see them: There is no crossover between the System's Ruby and your RVM-controlled RUby. That's the whole idea of a sandbox: separation of the elements and resources to avoid contamination.
You could have figured this all out by looking at the output of:
which ruby irb gem rake
The path for all of them is pointing to your sandbox:
/Users/daniel/.rvm/rubies
On a Mac OS system, that command should have reported:
/usr/bin/ruby
/usr/bin/irb
/usr/bin/gem
/usr/bin/rake
Reinstall Rails and the SQLite gem using:
gem install rails sqlite3
and see how your bundle behaves.
And, by the way, do NOT use sudo to deliberately try to manage/delete the System installed Ruby. That was installed by Apple for their own purposes, to enable software they installed. It's OK to take advantage of its existence, but it's there for their use. Use a RVM-managed Ruby for your own purposes.

Can't install ruby-debug, error: rb_method_entry_t.called_id

I'm trying to install ruby-debug. I'm using Mac OS 10.7.4, XCode version 2308, and Ruby version 1.9.3-p194.
Following the instructions here: http://guides.rubyonrails.org/debugging_rails_applications.html#debugging-with-ruby-debug, I tried running
sudo gem install ruby-debug
I got the following error:
Building native extensions. This could take a while...
ERROR: Error installing ruby-debug:
ERROR: Failed to build gem native extension.
/Users/andrew/.rvm/rubies/ruby-1.9.3-p194/bin/ruby extconf.rb
checking for rb_method_entry_t.called_id in method.h... no
checking for rb_control_frame_t.method_id in method.h... no
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers. Check the mkmf.log file for more
details. You may need configuration options.
Provided configuration options:
--with-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/Users/andrew/.rvm/rubies/ruby-1.9.3-p194/bin/ruby
--with-ruby-dir
--without-ruby-dir
--with-ruby-include
--without-ruby-include=${ruby-dir}/include
--with-ruby-lib
--without-ruby-lib=${ruby-dir}/lib
extconf.rb:16:in `block in <main>': break from proc-closure (LocalJumpError)
from /Users/andrew/.rvm/gems/ruby-1.9.3-p194/gems/ruby_core_source-0.1.5/lib/ruby_core_source.rb:18:in `call'
from /Users/andrew/.rvm/gems/ruby-1.9.3-p194/gems/ruby_core_source-0.1.5/lib/ruby_core_source.rb:18:in `create_makefile_with_core'
from extconf.rb:32:in `<main>'
Gem files will remain installed in /Users/andrew/.rvm/gems/ruby-1.9.3-p194/gems/ruby-debug-base19-0.11.26 for inspection.
Results logged to /Users/andrew/.rvm/gems/ruby-1.9.3-p194/gems/ruby-debug-base19-0.11.26/ext/ruby_debug/gem_make.out
So I tried the following command:
sudo gem install debugger
Which resulted in:
Fetching: columnize-0.3.6.gem (100%)
Fetching: debugger-ruby_core_source-1.1.3.gem (100%)
Fetching: debugger-linecache-1.1.1.gem (100%)
Building native extensions. This could take a while...
Fetching: debugger-1.1.4.gem (100%)
Building native extensions. This could take a while...
Successfully installed columnize-0.3.6
Successfully installed debugger-ruby_core_source-1.1.3
Successfully installed debugger-linecache-1.1.1
Successfully installed debugger-1.1.4
4 gems installed
Installing ri documentation for columnize-0.3.6...
Installing ri documentation for debugger-ruby_core_source-1.1.3...
Installing ri documentation for debugger-linecache-1.1.1...
Couldn't find file to include 'VERSION' from lib/linecache19.rb
Installing ri documentation for debugger-1.1.4...
Installing RDoc documentation for columnize-0.3.6...
Installing RDoc documentation for debugger-ruby_core_source-1.1.3...
Installing RDoc documentation for debugger-linecache-1.1.1...
Couldn't find file to include 'VERSION' from lib/linecache19.rb
Installing RDoc documentation for debugger-1.1.4...
So I researched the issue and finally came across this post:
how do I install ruby-debug in ruby 1.9.3 / Rails 3.2.1
Everything worked until I tried the command:
gem install ruby-debug-base19-0.11.26.gem -- --with-ruby-include=$SANDBOX/packages/ruby-1.9.3-p194
Which just reproduced the first error, above. So I looked into
rb_method_entry_t.called_id
And found this post: https://github.com/ruby/ruby/pull/56/#issuecomment-3463264
I tried his suggested steps, except for rehash (which I'm not sure how to do with rvm, and didn't want to switch to rbenv just to try it). I downloaded all the gems he recommended to a folder, and ran the following command:
gem install *.gem -- --with-ruby-include=$(echo ~/.rvm/rubies/1.9.3-p194/include/ruby-1.9.1/ruby-1.9.3-p194/) --no-rdoc --no-ri
It installed linecache19-0.5.13 fine, but it choked on ruby-debug-base19-0.11.26.gem, producing the first error again.
I also tried uninstalling the debugger gems added when I ran sudo gem install debugger, but that hasn't changed anything.
I'm at a loss for what to do next.
ruby-debug is broken for ruby 1.9, give "pry" a try, instead. Maybe it is possible to get ruby-debug working but I wouldn't count on it.
Debugging in ruby 1.9
I know this question is rather old but I got the same error today and this the first result when I google the error.
For me debugger was installing as a dependency and running
gem install debugger
before bundle fixed it.
Just ran into this with Ruby 2.0.0 installed via RVM.
RVM will just install with the binaries if they are available, which is faster, but debugger needs the source too
rvm reinstall 2.0.0 --disable-binary

Error installing debugger-linecache in Ruby 1.9.3

I need version 1.0.1 of debugger-linecache for a project, and I am facing the following error when trying to install.
trunk ☺ gem install debugger-linecache -v '1.0.1'
Building native extensions. This could take a while...
ERROR: Error installing debugger-linecache:
ERROR: Failed to build gem native extension.
/Users/jordanscales/.rvm/rubies/ruby-1.9.3-p194/bin/ruby extconf.rb
checking for vm_core.h... no
checking for vm_core.h... no
Makefile creation failed
**************************************************************************
No source for ruby-1.9.3-p194 provided with debugger-ruby_core_source gem.
**************************************************************************
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers. Check the mkmf.log file for more
details. You may need configuration options.
Provided configuration options:
--with-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/Users/jordanscales/.rvm/rubies/ruby-1.9.3-p194/bin/ruby
--with-ruby-dir
--without-ruby-dir
--with-ruby-include
--without-ruby-include=${ruby-dir}/include
--with-ruby-lib
--without-ruby-lib=${ruby-dir}/lib
Gem files will remain installed in /Users/jordanscales/.rvm/gems/ruby-1.9.3-p194/gems/debugger-linecache-1.0.1 for inspection.
Results logged to /Users/jordanscales/.rvm/gems/ruby-1.9.3-p194/gems/debugger-linecache-1.0.1/ext/trace_nums/gem_make.out
trunk ☺
Any help would be extremely appreciated, I have been searching but cannot find a working solution.
this may help you, it works for me
gem install debugger-linecache -v '1.1.2' -- --with-ruby-include=$rvm_path/src/ruby-1.9.3-p286/
This error means that the selected version of debugger does not support your current Ruby version. There are two solutions:
Update the debugger gem via bundle update debugger. New versions of debugger are backward-compatible with old Ruby versions, so this is the best way to fix it.
Downgrade your Ruby version.
Update/Install the gem debugger-ruby_core_source,
gem install debugger-ruby_core_source
it has been corrected here : https://github.com/cldwalker/debugger-ruby_core_source/pull/7
The problem was that I was using gemsets incorrectly. I knew not having permissions were an issue, as under RVM I shouldn't need sudo to install anything.
rvm gemset use global and then a bundle install did the trick.
From the below link:
https://github.com/cldwalker/debugger/issues/50
I have installed gem ruby-debug19 and problem solved for me as below:
$ bundle
... -> failed to build debugger-linecache
$ gem install ruby-debug19
$ bundle
... -> all is fine
In my case problem was not related to debugger-linecache directly. Either try upgrading debugger-ruby_core_source or downgrade Ruby by few patchlevels.
I've executed bundle update debugger-linecache. Although I had its newest version in Gemfile.lock, debugger-ruby_core_source has been upgraded to 1.1.5 and debugger-linecache has stopped complaining.
I installed debugger-ruby_core_source gem, based on perusing old answers here: https://github.com/cldwalker/debugger/issues/12
If you are using rvm, then make sure the path lead to ruby, in rvm its rubies folder
$rvm_path/rubies/ruby-1.9.3-p448
gem install debugger-linecache -v '1.1.2' -- --with-ruby-include=$rvm_path/rubies/ruby-1.9.3-p448
Your Gemfile.lock wasn't written with the same Ruby that you're trying to bundle against.
bundle update should work by making Bundler look at different versions.
manually build it. it works for me
https://gist.github.com/4060260

Problems with jslint-v8 Ruby gem installation on Windows7 64-bit

There is a problem during Rally App SDK 2.0p environment setup on Windows 7 (64-bit). I have installed Ruby 1.8.7-p358 from rubyinstaller.org and managed to install rake Ruby gem. But I have problems installing jslint-v8 gem. It has dependencies on therubyracer and libv8 gems which need to be built using Ruby DevKit. During the installation I got the following error:
C:\ruby> gem install jslint-v8
Temporarily enhancing PATH to include DevKit...
Building native extensions. This could take a while...
ERROR: Error installing jslint-v8:
ERROR: Failed to build gem native extension.
C:/ruby/bin/ruby.exe extconf.rb
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers. Check the mkmf.log file for more
details. You may need configuration options.
Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=C:/ruby/bin/ruby
extconf.rb:13: uninitialized constant Gem (NameError)
Checking for Python...
Gem files will remain installed in C:/ruby/lib/ruby/gems/1.8/gems/libv8-3.3.10.4 for inspection.
Results logged to C:/ruby/lib/ruby/gems/1.8/gems/libv8-3.3.10.4/ext/libv8/gem_make.out
Does anyone know how to install it correctly in Win7?
Thank you!
The gem you try to install depends on libv8 gem, which is nothing more than a wrapper for Google V8 JavaScript VM.
There is no pre-compiled libv8 for Windows (like there is for Linux or OSX), this means it needs to build V8 from scratch.
The code around the build process of V8 is not very portable, not to mention that to compile libv8 you need Python installed :-P
Until today nobody was able to follow the instructions for libv8 pre-compilation on Windows, following the repository instructions:
https://github.com/cowboyd/libv8
Sorry not been able to provide you a better response.
Try this gem install libv8 -v '3.16.14.3' -- --with-system-v8
Reference: Error installing libv8: ERROR: Failed to build gem native extension
For building gem native extensions in Windows when you install a gem, you usually need the DevKit installed too:
http://rubyinstaller.org/downloads/ - go to the devkit download link
Their github page has instructions for installing it: https://github.com/oneclick/rubyinstaller/wiki/Development-Kit
I would also recommend using Ruby 1.9.3 instead of 1.8.7, but that shouldn't be much of an issue
Hope that helps.

Installing starling on Windows

I am trying to install the starling gem on my Windows machine. But, whenever I try to install it I get this error:
Building native extensions. This could take a while...
ERROR: Error installing starling:
ERROR: Failed to build gem native extension.
c:/ruby/bin/ruby.exe extconf.rb install starling -- --srcdir= c:\ruby-1.8.7-p72
checking for windows.h... no
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers. Check the mkmf.log file for more
details. You may need configuration options.
Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--srcdir=.
--curdir
--ruby=c:/ruby/bin/ruby
Gem files will remain installed in c:/ruby/lib/ruby/gems/1.8/gems/eventmachine-0
.12.2 for inspection.
Results logged to c:/ruby/lib/ruby/gems/1.8/gems/eventmachine-0.12.2/ext/gem_mak
e.out
What do I need to install to provide the windows.h header?
Gems is somewhat broken on Windows at present was at the time broken on Windows, but it's fixed now. The following workaround applies to the old One-Click Installer version of Ruby; you should really update to the new MinGW-based RubyInstaller and the DevKit to which the workaround still works, but is more future proof.
Locate a version of the problem gem (in this case it's eventmachine) that has a win32 binary. If you look on RubyForge, you'll see that the last eventmachine gem to possess a win32 binary is version 0.12.0
Force that version of event machine to install:
$ gem install eventmachine --version=0.12.0
Successfully installed eventmachine-0.12.0-x86-mswin32
1 gem installed
Installing ri documentation for eventmachine-0.12.0-x86-mswin32...
Installing RDoc documentation for eventmachine-0.12.0-x86-mswin32...
Now install try installing your original gem again:
$ gem install starling
Successfully installed ZenTest-3.10.0
Successfully installed memcache-client-1.5.0
Successfully installed SyslogLogger-1.4.0
Successfully installed starling-0.9.8
4 gems installed
Installing ri documentation for ZenTest-3.10.0...
Installing ri documentation for memcache-client-1.5.0...
Installing ri documentation for SyslogLogger-1.4.0...
Installing ri documentation for starling-0.9.8...
Installing RDoc documentation for ZenTest-3.10.0...
Installing RDoc documentation for memcache-client-1.5.0...
Installing RDoc documentation for SyslogLogger-1.4.0...
Installing RDoc documentation for starling-0.9.8...
Be warned though, if you now run gem update gems will stupidly try and install the latest version of eventmachine which, as we already know, won't build on Windows. This causes gem update to stop completely. See this question to find out how to work around this particular annoyance.
The install seems to be stuck on installing the eventmachine gem.
The easiest approach here may be to download and install the eventmachine binary gem for windows here
Otherwise you will need a compiler. (which I assume you don't have)
I don't know if this will work but someone is working on a one click installer of Ruby under Windows that comes with a C compiler.
See http://github.com/luislavena/rubyinstaller/tree/master
Now that everything is installed, is it possible to get it working under windows? I'm getting a fork() function unimplemented on this machine, because, Windows doesn't have a fork() process.

Resources