Search code examples
ruby-on-railsrubyrbenvtherubyracer

I can't install therubyracer in Arch Linux x64


When I try to install therubyracer, I get the following error:

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

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

make
compiling script.cc
compiling v8.cc
compiling backref.cc
compiling value.cc
compiling accessor.cc
compiling trycatch.cc
compiling primitive.cc
compiling external.cc
compiling date.cc
compiling exception.cc
compiling init.cc
compiling template.cc
compiling message.cc
compiling stack.cc
compiling gc.cc
compiling string.cc
compiling handles.cc
compiling function.cc
compiling heap.cc
compiling invocation.cc
compiling locker.cc
compiling object.cc
compiling array.cc
compiling constants.cc
compiling rr.cc
compiling signature.cc
compiling constraints.cc
compiling context.cc
context.cc: In static member function ‘static VALUE rr::Context::SetData(VALUE, VALUE)’:
context.cc:81:3: error: no matching function for call to ‘v8::Context::SetData(rr::String)’
context.cc:81:3: note: candidate is:
In file included from rr.h:4:0,
                 from context.cc:1:
/usr/include/v8.h:3721:8: note: void v8::Context::SetData(v8::Handle<v8::Value>)
/usr/include/v8.h:3721:8: note:   no known conversion for argument 1 from ‘rr::String’ to ‘v8::Handle<v8::Value>’
make: *** [context.o] Error 1


Gem files will remain installed in /home/carlos/.rbenv/versions/1.9.3-p327/lib/ruby/gems/1.9.1/gems/therubyracer-0.11.0 for inspection.
Results logged to /home/carlos/.rbenv/versions/1.9.3-p327/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.

I have no idea of what's happening.


Solution

  • Actually, it was a little tricky.

    I use my custom dotfiles, so, I have ~/.dotfiles/bin in my PATH.

    I also been noticed that the issue is related to python v3 vs v2.

    So, the fix was pretty easy, without break my system:

    ln -s /usr/bin/python2 ~/.dotfiles/bin
    reload
    gem install libv8 --verbose
    bundle
    

    Leaving my Gemfile like this:

    [...]
    gem 'therubyracer', :require => 'v8', :platforms => :ruby
    [...]
    

    And BOOM, it worked.

    Thanks for your help guys. Sorry for the delay to reply.

    Cheers


    EDIT

    Issue was fixed in the newer therubyracer release (0.11.1).