Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
654 views
in Technique[技术] by (71.8m points)

ruby on rails - bundle install / update: libv8 (therubyracer) installation fails (with native extensions)

I recently wanted to update my gem bundle but ran into installation problems with libv8 (requirement for therubyracer):

Installing libv8 (3.3.10.3) with native extensions /usr/local/rvm/rubies/ruby-1.9.3-head/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:552:in `rescue in block in build_extensions': ERROR: Failed
 to build gem native extension. (Gem::Installer::ExtensionBuildError)

        /usr/local/rvm/rubies/ruby-1.9.3-head/bin/ruby extconf.rb 
Checking for Python...*** 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.

I have found the issue report on therubyracer github site and it suggests to uninstall and reinstall libv8, but this does not work on my Ubuntu 11.04 machine. Any ideas - or am I stuck with the old version for a while?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

I had a similar issue on my good old Ubuntu 10.04 (x64)

After I updated the project Gemfile had those gems

  gem 'libv8', '~> 3.11.8'
  gem "therubyracer", '>= 0.11.0beta1', :require => 'v8'

But when I ran 'bundle install' I got an error

Installing therubyracer (0.11.0beta1) with native extensions 
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

        /home/sseletskyy/.rvm/rubies/ruby-1.9.3-p194/bin/ruby extconf.rb 
checking for main() in -lpthread... yes
creating Makefile

make
compiling array.cc
compiling script.cc
compiling object.cc
compiling constants.cc
compiling signature.cc
compiling value.cc
compiling locker.cc
compiling init.cc
compiling heap.cc
compiling date.cc
compiling message.cc
compiling accessor.cc
compiling context.cc
compiling exception.cc
compiling backref.cc
compiling trycatch.cc
compiling gc.cc
compiling handles.cc
compiling stack.cc
compiling template.cc
compiling function.cc
compiling primitive.cc
compiling rr.cc
compiling v8.cc
compiling invocation.cc
compiling string.cc
compiling external.cc
compiling constraints.cc
linking shared-object v8/init.so
/home/sseletskyy/.rvm/gems/ruby-1.9.3-p194/gems/libv8-3.11.8.2-x86_64-linux/vendor/v8/out/x64.release/obj.target/tools/gyp/libv8_base.a: could not read symbols: No such file or directory
collect2: ld returned 1 exit status
make: *** [init.so] Error 1


Gem files will remain installed in /home/sseletskyy/.rvm/gems/ruby-1.9.3-p194/gems/therubyracer-0.11.0beta1 for inspection.
Results logged to /home/sseletskyy/.rvm/gems/ruby-1.9.3-p194/gems/therubyracer-0.11.0beta1/ext/v8/gem_make.out
An error occured while installing therubyracer (0.11.0beta1), and Bundler cannot continue.
Make sure that `gem install therubyracer -v '0.11.0beta1'` succeeds before bundling.

Here's a list of steps which worked for me to solve that block quickly

  1. Uninstall all versions of gems 'libv8' and 'therubyracer'

    > gem uninstall therubyracer

    > gem uninstall libv8

  2. Install therubyracer manually

    > gem install therubyracer

    Fetching: libv8-3.3.10.4-x86_64-linux.gem (100%) Fetching: therubyracer-0.10.1.gem (100%) Building native extensions. This could take a while... Successfully installed libv8-3.3.10.4-x86_64-linux Successfully installed therubyracer-0.10.1 2 gems installed Installing ri documentation for libv8-3.3.10.4-x86_64-linux... Installing ri documentation for therubyracer-0.10.1... Installing RDoc documentation for libv8-3.3.10.4-x86_64-linux... Installing RDoc documentation for therubyracer-0.10.1...

  3. Check versions of installed gems

    > gem list | grep libv

    libv8 (3.3.10.4 x86_64-linux)

    > gem list | grep therubyracer

    therubyracer (0.10.1)

  4. Set those versions in Gemfile and run

    > bundle install

  5. Summary. Well I understand that in my case I used not the latest versions and it could be bad for compatibility sake. But at least I could continue development.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...