在OS X 10.9+安装li​​bv8宝石在OS X 10.9+安装li​​bv8宝石(Insta

2019-05-12 11:53发布

我试图安装libv8 3.16.14.3但使用最新的稳定RVM和Ruby-1.9.3-P125在OSX小牛得到一个错误。

这是运行命令“创业板安装libv8”的输出:

~/src(branch:master) » gem install libv8
Fetching: libv8-3.16.14.3.gem (100%)
Building native extensions.  This could take a while...
ERROR:  Error installing therubyracer:
  ERROR: Failed to build gem native extension.

    /Users/me/.rvm/rubies/ruby-1.9.3-p125/bin/ruby extconf.rb
creating Makefile
Compiling v8 for x64
Using python 2.7.5
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Unable to find a compiler officially supported by v8.
It is recommended to use GCC v4.4 or higher
Using compiler: g++
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Unable to find a compiler officially supported by v8.
It is recommended to use GCC v4.4 or higher
libtool: unrecognized option `-static'
libtool: Try `libtool --help' for more information.
make[1]: *** [/Users/me/.rvm/gems/ruby-1.9.3-p125@proj-rails3-ruby19/gems/libv8-3.16.14.3/vendor/v8/out/x64.release/libpreparser_lib.a] Error 1
make: *** [x64.release] Error 2
/Users/me/.rvm/gems/ruby-1.9.3-p125@proj-rails3-ruby19/gems/libv8-3.16.14.3/ext/libv8/location.rb:36:in `block in verify_installation!': libv8 did not install properly, expected binary v8 archive '/Users/me/.rvm/gems/ruby-1.9.3-p125@proj-rails3-ruby19/gems/libv8-3.16.14.3/vendor/v8/out/x64.release/obj.target/tools/gyp/libv8_base.a'to exist, but it was not found (Libv8::Location::Vendor::ArchiveNotFound)
  from /Users/me/.rvm/gems/ruby-1.9.3-p125@proj-rails3-ruby19/gems/libv8-3.16.14.3/ext/libv8/location.rb:35:in `each'
  from /Users/me/.rvm/gems/ruby-1.9.3-p125@proj-rails3-ruby19/gems/libv8-3.16.14.3/ext/libv8/location.rb:35:in `verify_installation!'
  from /Users/me/.rvm/gems/ruby-1.9.3-p125@proj-rails3-ruby19/gems/libv8-3.16.14.3/ext/libv8/location.rb:26:in `install!'
  from extconf.rb:7:in `<main>'
GYP_GENERATORS=make \
  build/gyp/gyp --generator-output="out" build/all.gyp \
                -Ibuild/standalone.gypi --depth=. \
                -Dv8_target_arch=x64 \
                -S.x64  -Dv8_enable_backtrace=1 -Dv8_can_use_vfp2_instructions=true -Darm_fpu=vfpv2 -Dv8_can_use_vfp3_instructions=true -Darm_fpu=vfpv3
  CXX(target) /Users/me/.rvm/gems/ruby-1.9.3-p125@proj-rails3-ruby19/gems/libv8-3.16.14.3/vendor/v8/out/x64.release/obj.target/preparser_lib/src/allocation.o
  CXX(target) /Users/me/.rvm/gems/ruby-1.9.3-p125@proj-rails3-ruby19/gems/libv8-3.16.14.3/vendor/v8/out/x64.release/obj.target/preparser_lib/src/atomicops_internals_x86_gcc.o
  CXX(target) /Users/me/.rvm/gems/ruby-1.9.3-p125@proj-rails3-ruby19/gems/libv8-3.16.14.3/vendor/v8/out/x64.release/obj.target/preparser_lib/src/bignum.o
  CXX(target) /Users/me/.rvm/gems/ruby-1.9.3-p125@proj-rails3-ruby19/gems/libv8-3.16.14.3/vendor/v8/out/x64.release/obj.target/preparser_lib/src/bignum-dtoa.o
  CXX(target) /Users/me/.rvm/gems/ruby-1.9.3-p125@proj-rails3-ruby19/gems/libv8-3.16.14.3/vendor/v8/out/x64.release/obj.target/preparser_lib/src/cached-powers.o
  CXX(target) /Users/me/.rvm/gems/ruby-1.9.3-p125@proj-rails3-ruby19/gems/libv8-3.16.14.3/vendor/v8/out/x64.release/obj.target/preparser_lib/src/conversions.o
  CXX(target) /Users/me/.rvm/gems/ruby-1.9.3-p125@proj-rails3-ruby19/gems/libv8-3.16.14.3/vendor/v8/out/x64.release/obj.target/preparser_lib/src/diy-fp.o
  CXX(target) /Users/me/.rvm/gems/ruby-1.9.3-p125@proj-rails3-ruby19/gems/libv8-3.16.14.3/vendor/v8/out/x64.release/obj.target/preparser_lib/src/dtoa.o
  CXX(target) /Users/me/.rvm/gems/ruby-1.9.3-p125@proj-rails3-ruby19/gems/libv8-3.16.14.3/vendor/v8/out/x64.release/obj.target/preparser_lib/src/fast-dtoa.o
  CXX(target) /Users/me/.rvm/gems/ruby-1.9.3-p125@proj-rails3-ruby19/gems/libv8-3.16.14.3/vendor/v8/out/x64.release/obj.target/preparser_lib/src/fixed-dtoa.o
  CXX(target) /Users/me/.rvm/gems/ruby-1.9.3-p125@proj-rails3-ruby19/gems/libv8-3.16.14.3/vendor/v8/out/x64.release/obj.target/preparser_lib/src/once.o
  CXX(target) /Users/me/.rvm/gems/ruby-1.9.3-p125@proj-rails3-ruby19/gems/libv8-3.16.14.3/vendor/v8/out/x64.release/obj.target/preparser_lib/src/preparse-data.o
  CXX(target) /Users/me/.rvm/gems/ruby-1.9.3-p125@proj-rails3-ruby19/gems/libv8-3.16.14.3/vendor/v8/out/x64.release/obj.target/preparser_lib/src/preparser.o
  CXX(target) /Users/me/.rvm/gems/ruby-1.9.3-p125@proj-rails3-ruby19/gems/libv8-3.16.14.3/vendor/v8/out/x64.release/obj.target/preparser_lib/src/preparser-api.o
  CXX(target) /Users/me/.rvm/gems/ruby-1.9.3-p125@proj-rails3-ruby19/gems/libv8-3.16.14.3/vendor/v8/out/x64.release/obj.target/preparser_lib/src/scanner.o
  CXX(target) /Users/me/.rvm/gems/ruby-1.9.3-p125@proj-rails3-ruby19/gems/libv8-3.16.14.3/vendor/v8/out/x64.release/obj.target/preparser_lib/src/strtod.o
  CXX(target) /Users/me/.rvm/gems/ruby-1.9.3-p125@proj-rails3-ruby19/gems/libv8-3.16.14.3/vendor/v8/out/x64.release/obj.target/preparser_lib/src/token.o
  CXX(target) /Users/me/.rvm/gems/ruby-1.9.3-p125@proj-rails3-ruby19/gems/libv8-3.16.14.3/vendor/v8/out/x64.release/obj.target/preparser_lib/src/unicode.o
  CXX(target) /Users/me/.rvm/gems/ruby-1.9.3-p125@proj-rails3-ruby19/gems/libv8-3.16.14.3/vendor/v8/out/x64.release/obj.target/preparser_lib/src/utils.o
  LIBTOOL-STATIC /Users/me/.rvm/gems/ruby-1.9.3-p125@proj-rails3-ruby19/gems/libv8-3.16.14.3/vendor/v8/out/x64.release/libpreparser_lib.a


Gem files will remain installed in /Users/me/.rvm/gems/ruby-1.9.3-p125@proj-rails3-ruby19/gems/libv8-3.16.14.3 for inspection.
Results logged to /Users/me/.rvm/gems/ruby-1.9.3-p125@proj-rails3-ruby19/gems/libv8-3.16.14.3/ext/libv8/gem_make.out

Answer 1:

这是由于这样的事实:OS X 10.9+是使用GCC 4.8版。 这是因为在拉请求(提及没有正式在旧版本libv8的支持https://github.com/cowboyd/libv8/pull/95 )。 请尝试在您的Gemfile撞了libv8的版本(或)一bundle update应该足够了。 希望这可以帮助。

从libv8 自述

带上你自己的V8

由于libv8是由therubyracer使用的V8引擎的界面,你可能需要使用libv8,即使你已经安装了V8。 如果你想使用自己的V8安装,而不是让它为你打造的,使用--with系统-V8选项。

使用RubyGems的:

创业板安装libv8 [-v YOUR_VERSION] - --with系统-V8

使用捆扎机(在你的Gemfile):

束的配置build.libv8 --with系统-V8

请注意,如果你打算运行自己的V8,您必须安装V8和标题(libv8-dev的发现Debian的发行版)。

带上你自己的编译器

你可以,或者添加--with-CXX =选项束配置由要么设置编译前,将CXX环境变​​量指定您选择的编译:

束的配置build.libv8 --with-CXX =铛++

编辑:

如果这个问题拿来就用therubyracer ,请尝试以下所建议rider_on_rails 这里 :

宝石卸载libv8

创业板安装therubyracer -v YOUR_RUBY_RACER_VERSION

创业板安装libv8 -v YOUR_VERSION - --with系统-V8



Answer 2:

实际上,你可以安装在小牛该版本:

gem install libv8 -v 3.11.8.17 -- --with-system-v8

我可以证实这一点也适用rbenv和红宝石1.9.3p448



Answer 3:

埃尔卡皮坦解决方案对我来说:

$ brew install v8
$ gem install libv8 -v REQUIRED_LIBV8_VERSION -- --with-system-v8

REQUIRED_LIBV8_VERSION对我来说是3.16.14.7 ,但你需要检查哪些是你在你的包需要一个(这是一个钢轨4.2.5

您可能还需要运行上面的命令,超级用户(如果你的宝石和系统库是全球性的)



Answer 4:

当我试图接受的答案,libv8将安装成功地与gem install libv8 ,但bundle install会失败上libv8。 我认为, bundle install试图安装不同版本libv8的。 我能找到适合我的解决方案。

我需要libv8因为therubyracer依赖于它。 为了得到它安装,我注意到,在失败中安装的版本gem_make.out日志therubyracer。 (用于路径gem_make.out日志会在失败的消息。)在我的情况下,它是3.16.14.7。 (此版本可能会随时间而改变,如果你从现在开始阅读这三年。)然后我做了这一点:

gem install libv8 -v 3.16.14.7 -- --with-v8-lib < -注意,从接受的答案不同标志

这使得这个工作:

gem install therubyracer

这让我完成我的bundle install

这为我工作在OSX上的优胜美地。



Answer 5:

https://github.com/cowboyd/therubyracer/issues/339

该链接上找到jasonlynes的解决方案所做的把戏我。 什么都没有工作。

brew install homebrew/versions/v8-315
brew link --overwrite v8-315 --force
gem install libv8 -v '3.16.14.13' -- --with-system-v8
gem install therubyracer -v '0.12.2' -- --with-system-v8


Answer 6:

试着用我总结了这样一个问题: 在OSX小牛“创业板安装therubyracer -v‘0.10.2’”不安装

它的工作对我来说(OS X小牛)



Answer 7:

我有同样的问题,当我从OSX山狮OSX小牛升级。 接受的答案工作了libv8,而不是当我去捆绑安装therubyracer宝石。

从红宝石-1.8.7-P354升级到红宝石1.8.7-375奏效了我。 libv8(3.16.14.3-x86_64的-达尔文-13)和没有问题地安装在therubyracer(0.12.0)宝石。

假设你使用rbenv:

rbenv versions
  system
  * 1.8.7-p354
  2.0.0-rc2

rbenv uninstall 1.8.7-p354
rbenv install 1.8.7-p375

rbenv versions
  system
  * 1.8.7-p375
  2.0.0-rc2

bundle install


Answer 8:

这种精细工作对我来说:

尝试安装此预编译的宝石:

https://dl.dropboxusercontent.com/u/7919548/gems/libv8/libv8-3.11.8.17-x86_64-darwin-13.gem (SHA1:5ce07aaf4085fff5a5e10fe018fd6b22021bef3b)

或者如果你喜欢建立自己的:

  git clone https://github.com/cowboyd/libv8.git
  cd libv8
  git checkout 3.11
  bundle install
  bundle exec rake clean build binary
  gem install pkg/libv8-3.11.8.17-x86_64-darwin-13.gem

来源: https://github.com/cowboyd/libv8/issues/107

由于菲利克斯Bünemann的修复!



Answer 9:

我尝试了一些在以前的答案列出的解决方案,却发现运行包(安装其他,缺少宝石)将尝试重新编译libv8(尽管有已经安装了成功地利用--with-system-v8 ),因此遭受从同样的问题。

最后,我发现,除去libv8宝石,取出由RubyGems的宝石文件,然后手动安装.gem与文件--with-system-v8为我工作的标志。

gem uninstall libv8
gem fetch libv8 -v LIBV8_VERSION
gem install libv8-LIBV_VERSION.gem -- --with-system-v8
bundle

由于拉夫阿加瓦尔的回答领导我正确的道路!



Answer 10:

您可以尝试手动编译和安装通过中提到的方法宝石的libv8 GitHub的网站。



Answer 11:

在MAC-优胜美地与RVM环境和Ruby-2.1.1版本

gem install libv8 -v 3.16.14.3 -- --with-v8-lib gem install therubyracer

它的工作原理与上面的命令的帮助,可以证实这一点。



Answer 12:

真正的工作对我来说是红宝石升级2.2.0,去除Gemfile.lock的,再捆绑上。

工作就像一个魅力!



Answer 13:

这是对我工作。

更换3.16.14.7与您的版本。

bundle install
gem install libv8 -v '3.16.14.7' -- --with-system-v8

bundle install
gem uninstall libv8 -v '3.16.14.7' -- --with-system-v8

brew install homebrew/dupes/apple-gcc42

export CC=/usr/local/Cellar/apple-gcc42/4.2.1-5666.3/bin/gcc-4.2
export CXX=/usr/local/Cellar/apple-gcc42/4.2.1-5666.3/bin/g++-4.2
export CPP=/usr/local/Cellar/apple-gcc42/4.2.1-5666.3/bin/cpp-4.2

bundle install


Answer 14:

我已经在酋长面临着类似的问题。 这里就是我所做的。

brew tap homebrew/dupes
brew install apple-gcc42

然后,

export CC=/usr/local/Cellar/apple-gcc42/4.2.1-5666.3/bin/gcc-4.2
export CXX=/usr/local/Cellar/apple-gcc42/4.2.1-5666.3/bin/g++-4.2
export CPP=/usr/local/Cellar/apple-gcc42/4.2.1-5666.3/bin/cpp-4.2

最后,

brew uninstall v8
gem install libv8 -v 3.11.8.17 -- --with-system-v8


Answer 15:

我使用的Xcode的beta版本的另一个项目,并已被遗忘。 切换回用xcode-select 。 就像是:

sudo xcode-select --switch /Applications/Xcode.app/


Answer 16:

从的Gemfile删除:

宝石 'therubyracer',:平台=>:红宝石



文章来源: Installing libv8 gem on OS X 10.9+