rubyrubygemstherubyracer

Unable to install therubyracer


I am trying to do a gem install therubyracer on Debian 6. I am using rbenv on 1.9.3. When I initially did it, it complained about libv8, so I did a gem install libv8. Now, when I run gem install therubyracer, I get the following error saying it can't find the file. The file it's talking about, /home/chop/.rbenv/versions/1.9.3-p327/lib/ruby/gems/1.9.1/gems/libv8-3.11.8.3-x86_64-linux/vendor/v8/out/x64.release/obj.target/tools/gyp/libv8_base.a, does exist however.

hop@fev-temp:~$ gem install therubyracer
Building native extensions.  This could take a while...
ERROR:  Error installing therubyracer:
    ERROR: Failed to build gem native extension.

        /home/chop/.rbenv/versions/1.9.3-p327/bin/ruby extconf.rb
checking for main() in -lpthread... yes
creating Makefile

make
compiling stack.cc
compiling accessor.cc
compiling constants.cc
compiling heap.cc
compiling init.cc
compiling primitive.cc
compiling signature.cc
compiling date.cc
compiling locker.cc
compiling exception.cc
compiling gc.cc
compiling script.cc
compiling external.cc
compiling v8.cc
compiling object.cc
compiling trycatch.cc
compiling context.cc
compiling string.cc
compiling value.cc
compiling array.cc
compiling invocation.cc
compiling message.cc
compiling constraints.cc
compiling function.cc
compiling backref.cc
compiling handles.cc
compiling template.cc
compiling rr.cc
linking shared-object v8/init.so
/home/chop/.rbenv/versions/1.9.3-p327/lib/ruby/gems/1.9.1/gems/libv8-3.11.8.3-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/chop/.rbenv/versions/1.9.3-p327/lib/ruby/gems/1.9.1/gems/therubyracer-0.11.0 for inspection.
Results logged to /home/chop/.rbenv/versions/1.9.3-p327/lib/ruby/gems/1.9.1/gems/therubyracer-0.11.0/ext/v8/gem_make.out

Solution

  • I just hit the exact same error. I looked at the gem details at https://rubygems.org/gems/therubyracer and it seems we were "lucky" enough to bundle a new version on the release day.

    This appears to already be reported: https://github.com/cowboyd/therubyracer/issues/215

    So, I figured the easiest thing is to use the last version of the gem. So I updated my Gemfile to point to the last version like so:

    gem "therubyracer", "~> 0.10.2"
    

    and I was able to successfully install the gem.

    If you want to manually install the gem, you can use:

    gem install therubyracer --version "~> 0.10.2"