rubyjs / therubyracer

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

Trouble installing therubyracer from maser on Ubuntu x64 #268

Closed SamSaffron closed 11 years ago

SamSaffron commented 11 years ago
sam@ubuntu:~/Source/therubyracer$ gem install pkg/therubyracer-0.12.0beta1.gem 
Building native extensions.  This could take a while...
ERROR:  Error installing pkg/therubyracer-0.12.0beta1.gem:
    ERROR: Failed to build gem native extension.

    /home/sam/.rbenv/versions/2.0.0-p247/bin/ruby extconf.rb
checking for main() in -lpthread... yes
creating Makefile

make "DESTDIR="
compiling handles.cc
compiling message.cc
compiling array.cc
compiling function.cc
compiling accessor.cc
compiling stack.cc
compiling template.cc
compiling script.cc
compiling gc.cc
compiling object.cc
compiling init.cc
compiling v8.cc
compiling constants.cc
compiling constraints.cc
compiling context.cc
compiling rr.cc
compiling heap.cc
compiling trycatch.cc
compiling signature.cc
compiling external.cc
compiling locker.cc
compiling exception.cc
compiling invocation.cc
compiling string.cc
compiling backref.cc
compiling value.cc
compiling date.cc
compiling primitive.cc
linking shared-object v8/init.so
/usr/bin/ld: /home/sam/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/libv8-3.16.14.1/vendor/v8/out/x64.release/obj.target/tools/gyp/libv8_base.a(api.o): relocation R_X86_64_32S against `_ZTVN2v810ScriptDataE' can not be used when making a shared object; recompile with -fPIC
/home/sam/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/libv8-3.16.14.1/vendor/v8/out/x64.release/obj.target/tools/gyp/libv8_base.a: could not read symbols: Bad value
collect2: error: ld returned 1 exit status
make: *** [init.so] Error 1

Gem files will remain installed in /home/sam/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/therubyracer-0.12.0beta1 for inspection.
Results logged to /home/sam/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/therubyracer-0.12.0beta1/ext/v8/gem_make.out

Is this something about my Ruby install?

cowboyd commented 11 years ago

Hi Sam,

Sorry for the confusion, and I apologize for the inconvenience. The currently released gem version of libv8 does not compile properly on ubuntu, but has since been fixed with cowboyd/libv8@cf58d33a830259f5749b129ab6d5282d4ee1a8e1. I would try installing both libv8 and therubyracer from master. Here is a sample Gemfile that should accomplish what you need:

source 'https://rubygems.org'

gem 'libv8', git: 'https://github.com/cowboyd/libv8.git', submodules: true
gem 'therubyracer', git: 'https://github.com/cowboyd/therubyracer.git'

Note the submodules: true option. This is necessary, because it needs to pull in and compile the v8 source from v8/v8 as a submodule.

We are in the process of pushing out a newer version of libv8 with binary versions for most major platforms, including linux-x64. I hope this helps, and I'm sorry for the delays.

cowboyd commented 11 years ago

I've now released libv8 3.16.14.2 which contains these fixes.

SamSaffron commented 11 years ago

Thanks heaps @cowboyd therubyracer is such a key piece of Discourse - you rock