Ruby-on-rails 捆绑安装/在导轨上安装 libv8 (3.3.10.4) 时出错(在 Lion 上运行)

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/9036105/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-03 02:42:39  来源:igfitidea点击:

bundle install / Error in Installing libv8 (3.3.10.4) on rails (running on Lion)

ruby-on-railsruby

提问by user1173832

I have added the gem 'sunspot_rails' in my gem file and ran bundle install. I have been getting errors in installing libv8 and the error message is as follows:

我在我的 gem 文件中添加了 gem 'sunspot_rails' 并运行了 bundle install。我在安装libv8时出现错误,错误信息如下:

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

        /opt/local/bin/ruby 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
    --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=/opt/local/bin/ruby
extconf.rb:13: uninitialized constant Gem (NameError)
Checking for Python...

Gem files will remain installed in /Users/sonyakim/.rvm/gems/ruby-1.9.2-p290/gems/libv8-3.3.10.4 for inspection.
Results logged to /Users/sonyakim/.rvm/gems/ruby-1.9.2-p290/gems/libv8-3.3.10.4/ext/libv8/gem_make.out
An error occured while installing libv8 (3.3.10.4), and Bundler cannot continue.
Make sure that `gem install libv8 -v '3.3.10.4'` succeeds before bundling.

When I run gem install libv8 -v '3.3.10.4', the following error message is printed:

当我运行 gem install libv8 -v '3.3.10.4' 时,会打印以下错误消息:

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

        /opt/local/bin/ruby 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
    --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=/opt/local/bin/ruby
extconf.rb:13: uninitialized constant Gem (NameError)
Checking for Python...

Gem files will remain installed in /Users/sonyakim/.rvm/gems/ruby-1.9.2-p290/gems/libv8-3.3.10.4 for inspection.
Results logged to /Users/sonyakim/.rvm/gems/ruby-1.9.2-p290/gems/libv8-3.3.10.4/ext/libv8/gem_make.out

How can I install libv8 properly?

如何正确安装 libv8?

回答by Nick

Force extconf.rb file to require rubygems on install:

强制 extconf.rb 文件在安装时需要 ruby​​gems:

RUBYOPT=-rrubygems gem install libv8 -v '3.3.10.4'

Found here: https://coderwall.com/p/y1djxq

在这里找到:https: //coderwall.com/p/y1djxq