我正在使用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'
在宝石文件中..
最佳答案
这可能发生在Ruby 1.8.7中,它没有像1.9.x那样自动包含红宝石。 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版本。我使用的是其他操作系统,因此请尝试一下,看看它是否适合您。