我无法在Arch Linux x64中安装therubyracer

当我尝试安装therubyracer时,我收到以下错误:

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) /usr/include/v8.h:3721:8: note: no known conversion for argument 1 from 'rr::String' to 'v8::Handle' 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. 

我不知道发生了什么。

实际上,这有点棘手。

我使用自定义的dotfiles ,所以,我的PATH中有~/.dotfiles/bin

我也注意到这个问题与python v3 vs v2有关 。

所以,修复非常简单,不会破坏我的系统:

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

像这样离开我的Gemfile

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

而BOOM,它的工作原理。

谢谢你的帮助。 很抱歉延迟回复。

干杯


编辑

问题在较新的therubyracer版本(0.11.1)中得到修复。

我在ArchLinux中遇到了同样的问题。 这是一个已知问题 。 我在archlinux上工作的解决方法是通过在Gemfile添加以下行来锁定到Gemfile

 gem 'therubyracer', '0.10.2', :platforms => :ruby 

我已经测试了它,它至少可以在64位上运行。 希望它对你也有用。

我强烈建议使用外部Node.js(我相信有一个正式的包),然后使用sstephenson / execjs 。

如果您正在使用Rails,它已经依赖于ExecJS,因此您可能只是删除对therubyracer的依赖,捆绑,安装Node.js,你就可以了。

您需要安装libv8 3.11.x才能获得最新版本的therubyracer。 所以尝试更新libv8然后再进行捆绑。