问题描述
我试图在小牛上安装以下宝石版本
- libv8(3.16.14.3)
- therubyracer(0.12.1)
显然therubyracer宝石取决于libv8。
1)安装libv8
什么是libv8?我的一点研究似乎暗示它是Google Chrome使用的某种JavaScript库?
我在安装时遇到了问题,但既有我的错误,也有关于如何绕过它的一个很好解释的答案。
因此,我用
gem安装了 libv8
安装libv8 - --with-system-v8
我的理解是,这会安装gem,但会使用我的本地系统安装的V8库,而不是...该版本与宝石?无论哪种方式,它都是成功的。
2)安装therubyracer
在下一步中,我遇到了安装 therubyracer
宝石。我不太确定这个gem是做什么的,只是它是一个rails项目的依赖关系,我试图 bundle install
。
它给了我以下错误:
Gem :: Ext :: BuildError:错误:无法构建宝石本地扩展。
/Users/jeeves.butler/.rvm/rubies/ruby-1.9.2-p290/bin/ruby extconf.rb
检查main()in -lpthread ... yes
检查-lobjc中的main()... yes
检查v8.h ... no
*** extconf.rb失败***
无法创建Makefile由于某种原因,可能缺少
必需的库和/或头文件。查看mkmf.log文件以获取更多
的详细信息。您可能需要配置选项。
提供的配置选项:
--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:在
'configure'中:您选择在系统上使用V8的版本
(Libv8 :: Location: :System :: NotFoundError)
和* not *与libv8 rubygem捆绑在一起。但是,
无法找到。请确保您有一个与安装的3.16.14.3兼容的
v8版本。如果
位于非标准
位置
谢谢,
Mgmt
可能需要特殊的--with-v8-dir选项
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:在< main>中
extconf失败,退出代码1
Gem文件将保持安装在/Users/jeeves.butler/.rvm /gems/ruby-1.9.2-p290/gems/therubyracer-0.12.1进行检查。
记录到/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 $ b的结果$ b
从我可以收集的内容中,我选择安装 libv8
使用我的本地V8库而不是 libv8
提供的内容,但现在无法找到本地安装。
- 我如何检查是否确实安装了V8,并且如何找到它?
- 我尝试了一些指定的标志,但没有一个似乎将gem指向正确的安装目录
- 这可能是一个单独的主题,但什么是
extconf.rb
?我在几个地方见过。它试图在特定的gcc
编译器中做什么?
谢谢编辑:
-
我尝试了卸载libv8并通过
brew install $ c $重新安装C>。在几个类似的问题中也提到了它。
我也尝试过
CC
,CXX
和CPP
环境变量,如,尽管我不认为这有什么影响,因为它已经拿起我的gcc v4.6
编译器。
操作系统: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
I'm trying to install the following gem versions on Mavericks
- libv8 (3.16.14.3)
- therubyracer (0.12.1)
Obviously therubyracer gems depends on libv8.
1) Installing libv8
What is libv8? My bit of research seems to indicaite it's some sort of javascript library used by Google Chrome?
I was having trouble installing it, but this great post had both my error and a well-explained answer on how to bypass it.
So I installed libv8
with
gem install libv8 -- --with-system-v8
It's my understanding that this installs the gem but uses my local system installation of the v8 library instead of... the version that comes with the gem? Either way, it was successful.
2) Installing therubyracer
During the next step, I had trouble install therubyracer
gem. I'm not quite sure what this gem does, just that it's a dependency of a rails project I'm trying to bundle install
.
It gives me the following error:
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
From what I can gather, I chose to install libv8
using my local V8 library instead of what was provided with libv8
, but now that local installation could not be located.
- How do I check if I do indeed have V8 installed and how do I locate it?
- I tried a few of the specified flags, none of them seemed to point the gem to the correct installation directory
- This might be a separate topic, but what is
extconf.rb
? I've seen it in a few places. And what's it trying to do with thegcc
compiler in specific?
Thanks!!
EDIT:
I tried this solution of uninstalling libv8 and re-installing via
brew install
. It was mentioned in a couple of similar questions as well. No luck.I also tried the
CC
,CXX
, andCPP
environment variables as described here, although I don't think that has any effect as it was already picking up mygcc v4.6
compiler.
This steps worked for me.
OS: MaverickRuby: 2.1.1
gem uninstall libv8
gem install therubyracer -v '0.11.3'
gem install libv8 -v '3.11.8.13' -- --with-system-v8
这篇关于therubyracer - Gem :: Ext :: BuildError:错误:无法构建gem原生扩展的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!