I am running 'bundle install' on my linode server. But not able to install cause of rubyracer. Bundle install output is:
Installing therubyracer (0.11.0)
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/usr/local/bin/ruby extconf.rb
checking for main() in -lpthread... 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=/usr/local/bin/ruby
--with-pthreadlib
--without-pthreadlib
--enable-debug
--disable-debug
/usr/local/lib/ruby/gems/1.9.1/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 /usr/local/lib/ruby/gems/1.9.1/gems/therubyracer-0.11.0 for inspection.
Results logged to /usr/local/lib/ruby/gems/1.9.1/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.
Actually gem rubyracer is installed but version is 0.11.4. I just don't know why it is not taking this version and accepting only 0.11.0.
Also how to install 0.11.0. When i run the command given in error "gem install therubyracer -v '0.11.0'", it fails to execute and gives:
Building native extensions. This could take a while...
ERROR: Error installing therubyracer:
ERROR: Failed to build gem native extension.
/usr/local/bin/ruby extconf.rb
checking for main() in -lpthread... 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=/usr/local/bin/ruby
--with-pthreadlib
--without-pthreadlib
--enable-debug
--disable-debug
/usr/local/lib/ruby/gems/1.9.1/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 /usr/local/lib/ruby/gems/1.9.1/gems/therubyracer- 0.11.0 for inspection.
Results logged to /usr/local/lib/ruby/gems/1.9.1/gems/therubyracer-0.11.0/ext/v8/gem_make.out
Can anybody here help? searched lot on stack and git but none of the given solutions working.
My gemfile:
source 'https://rubygems.org'
gem 'rails', '3.2.12'
gem "paperclip"
gem 'mysql2'
gem "devise"
group :assets do
gem 'sass-rails', '~> 3.2.3'
gem 'coffee-rails', '~> 3.2.1'
gem 'uglifier', '>= 1.0.3'
end
gem 'jquery-rails'
gem 'libv8', '3.11.8.4', :platform => :ruby
gem 'therubyracer', '0.11.0', :platforms => :ruby
gem 'rails_admin'
gem 'unicorn'
gem 'delayed_job_active_record'
gem 'daemons'
I was face the same problem on ubuntu:
After some experimentation I was able to confirm that 'gem install therubyracer --pre
' on the command line worked okay, but telling bundler to use the --pre
option didn't work:
bundle config build.therubyracer --pre
I don't know if that was because the gem was being pulled in via a dependency and not by an explicit 'gem' line in the Gemfile. I was unable to fix this even after extensive Googling, but since 0.11 seems to be only a few hours old I decided to try reverting to the previous 0.10
version by adding:
gem 'therubyracer', '=0.10'
before the use of the gem that depended on it. This forced bundler to pick the earlier version and it installed like a charm. Hopefully someone will fix 0.11
soon enough.
After looking at the issues for therubyracer on github this seems to be related to two different issues - one closed: https://github.com/cowboyd/therubyracer/issues/213 which suggests installing the libv8 gem first (or explicitly), and that causes a different error: https://github.com/cowboyd/therubyracer/issues/215 and that is not yet closed - the libv8 gem seems to have a corrupted binary in it for 64-bit targets. The only solution appears to be to build libv8 from source or do like I did and back up to 0.11beta8 or earlier (someone says 0.11beta8
works). Until then I suggest you watch the 215 issue on Github and await a fix.
Thanks.