3

我正在使用 FreeBSd 操作系统,当我尝试安装 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'

在宝石文件..

4

1 回答 1

2

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

但这似乎不在此时已发布的 gem 中。它应该像这样安装一样简单:

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

但是从源码看,它动态地将gem版本与v8库的版本关联起来,当我尝试时,它失败了,说是0.0.4版本。不过,我使用的是不同的操作系统,因此请尝试一下,看看它是否适合您。

于 2012-03-01T22:20:56.863 回答