FreeBSD OS中的Ruby On Rails安装 - libv8中的错误

时间:2012-03-01 08:36:10

标签: ruby-on-rails ruby-on-rails-3 rubygems freebsd bundle-install

使用FreeBSd OS,当我尝试安装libv8时,

gem install libv8

它抛出错误......

Building native extensions.  This could take a while...
ERROR:  Error installing therubyracer:
ERROR: Failed to build gem native extension.

        /usr/local/bin/ruby18 extconf.rb
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers.  Check the mkmf.log file for more
details.  You may need configuration options.

Provided configuration options:
    --with-opt-dir
    --without-opt-dir
    --with-opt-include
    --without-opt-include=${opt-dir}/include
    --with-opt-lib
    --without-opt-lib=${opt-dir}/lib
    --with-make-prog
    --without-make-prog
    --srcdir=.
    --curdir
    --ruby=/usr/local/bin/ruby18
extconf.rb:13: uninitialized constant Gem (NameError)
Checking for Python...


extconf.rb:13: uninitialized constant Gem 

我已经搞砸了

gem 'therubyracer'
gem 'libv8', '3.3.10.4'
宝石文件中的

..

1 个答案:

答案 0 :(得分:2)

这可能发生在Ruby 1.8.7中,它不会像1.9.x那样自动包含ruby gems。 github上有一个更新:https://github.com/fractaloop/libv8/blob/master/ext/libv8/extconf.rb

但此时似乎并未出现在已发布的宝石中。 应该像这样安装一样简单:

gem 'libv8', :git => 'git://github.com/fractaloop/libv8.git'

但是从查看源代码,它会动态地将gem版本与v8库的版本相关联,当我尝试它时,它失败了,说它是版本0.0.4。我在不同的操作系统上,所以试一试,看看它是否适合你。