rubyjs / therubyracer

Embed the V8 Javascript Interpreter into Ruby
1.66k stars 191 forks source link

gem install therubyracer -v '0.12.1' fails with Ubuntu 12.04.05 and Ruby 2.2.1 #331

Closed tirdadc closed 8 years ago

tirdadc commented 9 years ago
Distributor ID: Ubuntu
Description:    Ubuntu 12.04.5 LTS
Release:    12.04
Codename:   precise

I've recently upgraded to Ruby 2.2.1 on my Ubuntu machine and have been experiencing issues with therubyracer and libv8:

gem install therubyracer -v '0.12.1'
Fetching: libv8-3.16.14.7-x86_64-linux.gem (100%)
Successfully installed libv8-3.16.14.7-x86_64-linux
Building native extensions.  This could take a while...
ERROR:  Error installing therubyracer:
    ERROR: Failed to build gem native extension.

    /home/tirdad/.rvm/rubies/ruby-2.2.1/bin/ruby -r ./siteconf20150306-10772-1ksb7v7.rb extconf.rb
checking for main() in -lpthread... yes
creating Makefile

make "DESTDIR=" clean

make "DESTDIR="
compiling signature.cc
compiling constraints.cc
compiling locker.cc
compiling rr.cc
compiling heap.cc
compiling init.cc
compiling function.cc
compiling array.cc
compiling constants.cc
compiling stack.cc
compiling primitive.cc
compiling invocation.cc
compiling message.cc
compiling external.cc
compiling v8.cc
compiling backref.cc
compiling string.cc
compiling object.cc
compiling script.cc
compiling trycatch.cc
compiling template.cc
compiling value.cc
compiling context.cc
compiling handles.cc
compiling date.cc
compiling gc.cc
compiling exception.cc
compiling accessor.cc
linking shared-object v8/init.so
g++: error: /home/tirdad/.rvm/gems/ruby-2.2.1/gems/libv8-3.16.14.7-x86_64-linux/vendor/v8/out/ia32.release/obj.target/tools/gyp/libv8_base.a: No such file or directory
g++: error: /home/tirdad/.rvm/gems/ruby-2.2.1/gems/libv8-3.16.14.7-x86_64-linux/vendor/v8/out/ia32.release/obj.target/tools/gyp/libv8_snapshot.a: No such file or directory
make: *** [init.so] Error 1

make failed, exit code 2

Gem files will remain installed in /home/tirdad/.rvm/gems/ruby-2.2.1/gems/therubyracer-0.12.1 for inspection.
Results logged to /home/tirdad/.rvm/gems/ruby-2.2.1/extensions/x86_64-linux/2.2.0/therubyracer-0.12.1/gem_make.out

I tried both with and without --with-system-v8, uninstalling both libv8 and therubyracer, fixing the versions in the Gemfile, and no luck. Not sure what is going on at this point.

These are the lines in my Gemfile:

gem 'libv8'
gem 'therubyracer', '~> 0.12.1', platforms: :ruby

which result in this in the Gemfile.lock:

libv8 (3.16.14.7)
[...]
therubyracer (0.12.1)
      libv8 (~> 3.16.14.7)
      ref
mdchaney commented 9 years ago

This is a libv8 issue. Easy way to see:

mdchaney@li212-252:~/hdm-dev.michaelchaney.com$ irb
2.2-head :001 > gem 'libv8'
 => true 
2.2-head :002 > require 'libv8'
 => true 
2.2-head :003 > Libv8::Paths.object_paths
 => ["/usr/local/rvm/gems/ruby-2.2-head/gems/libv8-3.16.14.7-x86_64-linux/vendor/v8/out/ia32.release/obj.target/tools/gyp/libv8_base.a", "/usr/local/rvm/gems/ruby-2.2-head/gems/libv8-3.16.14.7-x86_64-linux/vendor/v8/out/ia32.release/obj.target/tools/gyp/libv8_snapshot.a"] 

Basically, libv8 is saying "my object files are stored in this directory". Still digging on this one, but libv8 is apparently the culprit.

cowboyd commented 9 years ago

Are you running a 32bit kernel?

ignisf commented 9 years ago

The other way around -- rubygems has difficulties fetching the binary gems for the correct arch whenever one is running a 32-bit userland on a 64-bit kernel.

tokland commented 7 years ago

As a workaround, this worked for me (I needed 0.12.2):

$ gem install therubyracer -v0.12.2 --platform=x86_64