首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >therubyracer Gem::Ext::BuildError: ERROR:无法构建gem本机扩展

therubyracer Gem::Ext::BuildError: ERROR:无法构建gem本机扩展
EN

Stack Overflow用户
提问于 2014-05-08 16:44:37
回答 15查看 47.9K关注 0票数 84

我正在尝试在Mavericks上安装以下gem版本

  • libv8

(0.12.1) (0.12.1)

显然,竞技者的宝石依赖于libv8。

1)安装libv8

什么是libv8?我的一点研究似乎表明它是Google Chrome使用的某种javascript库?

我在安装它时遇到了问题,但是this great post有我的错误和关于如何绕过它的一个很好的解释的答案。

所以我在安装libv8的时候

gem install libv8 -- --with-system-v8

据我所知,这将安装gem,但使用我的本地系统安装的v8库,而不是...gem附带的版本是什么?无论哪种方式,它都是成功的。

2)安装therubyracer

在下一步中,我在安装therubyracer gem时遇到了问题。我不太确定这个gem是做什么的,只知道它是我正在尝试bundle install的一个rails项目的依赖项。

它给出了以下错误:

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    /Users/jeeves.butler/.rvm/rubies/ruby-1.9.2-p290/bin/ruby extconf.rb 
checking for main() in -lpthread... yes
checking for main() in -lobjc... yes
checking for v8.h... no
*** 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=/Users/jeeves.butler/.rvm/rubies/ruby-1.9.2-p290/bin/ruby
    --with-pthreadlib
    --without-pthreadlib
    --with-objclib
    --without-objclib
    --enable-debug
    --disable-debug
    --with-v8-dir
    --without-v8-dir
    --with-v8-include
    --without-v8-include=${v8-dir}/include
    --with-v8-lib
    --without-v8-lib=${v8-dir}/lib
/Users/jeeves.butler/.rvm/gems/ruby-1.9.2-p290/gems/libv8-3.16.14.3/ext/libv8/location.rb:50:in 
'configure': You have chosen to use the version of V8 found 
on your system (Libv8::Location::System::NotFoundError)
and *not* the one that is bundled with the libv8 rubygem. However,
it could not be located. please make sure you have a version of
v8 that is compatible with 3.16.14.3 installed. You may
need to special --with-v8-dir options if it is in a non-standard
location

thanks,
The Mgmt

    from /Users/jeeves.butler/.rvm/gems/ruby-1.9.2-p290/gems/libv8-3.16.14.3/lib/libv8.rb:7:in `configure_makefile'
    from extconf.rb:32:in `<main>'

extconf failed, exit code 1

Gem files will remain installed in /Users/jeeves.butler/.rvm/gems/ruby-1.9.2-p290/gems/therubyracer-0.12.1 for inspection.
Results logged to /Users/jeeves.butler/.rvm/gems/ruby-1.9.2-p290/extensions/x86_64-darwin-13/1.9.1/therubyracer-0.12.1/gem_make.out

据我所知,我选择使用我本地的V8库安装libv8,而不是使用libv8提供的库,但现在无法定位本地安装。

  • 如何检查我是否确实安装了V8,以及如何找到它?
  • 我尝试了几个指定的标志,但似乎没有一个标志将gem指向正确的安装directory
  • This可能是一个单独的主题,但什么是extconf.rb?我在几个地方见过它。

到底想用gcc编译器做什么呢?

谢谢!!

编辑:

  1. 我尝试了通过this solution卸载libv8并通过brew install重新安装。在一些类似的问题中也提到了这一点。不走运。
  2. 我还尝试了here中描述的CCCXXCPP环境变量,尽管我认为这不会有任何效果,因为它已经开始使用我的gcc v4.6编译器了。
EN

回答 15

Stack Overflow用户

回答已采纳

发布于 2014-09-04 15:40:55

这个步骤对我很有效。

操作系统: Maverick Ruby: 2.1.1

gem uninstall libv8
gem install therubyracer -v '0.11.3'
gem install libv8 -v '3.11.8.13' -- --with-system-v8
票数 167
EN

Stack Overflow用户

发布于 2016-03-29 05:33:15

对于那些在OS Capitan中面临这个问题的人来说,来自therubyracer问题线程的this solution最终对我起到了作用:

brew tap homebrew/versions
brew install v8-315

gem install libv8 -v '3.16.14.13' -- --with-system-v8
gem install therubyracer -- --with-v8-dir=/usr/local/opt/v8-315

bundle install

我之前也运行过brew install gcc,但我不确定这是否真的有必要。

票数 75
EN

Stack Overflow用户

发布于 2014-05-09 03:29:54

尝试先卸载rubyracer gem,然后安装rubyracer,然后再安装libv8。

gem uninstall libv8
gem install therubyracer
gem install libv8 -- --with-system-v8
票数 26
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/23536893

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档