在OS X 10.9+上安装libv8 gem [英] Installing libv8 gem on OS X 10.9+

查看:162
本文介绍了在OS X 10.9+上安装libv8 gem的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试安装libv8 3.16.14.3,但在使用最新的stable rvm和ruby-1.9.3-p125的OSX Mavericks上出现错误。

这是运行命令'gem install libv8'的输出:

 〜/ src(分支:master)»gem install libv8 
提取:libv8-3.16.14.3.gem(100%)
构建原生扩展。这可能需要一段时间...
错误:安装therubyracer时出错:
错误:无法构建gem原生扩展。

/Users/me/.rvm/rubies/ruby-1.9.3-p125/bin/ruby extconf.rb
创建Makefile
为x64编译v8
使用python 2.7.5
配置:--prefix = / Applications / Xcode.app /目录/ Developer / usr --with-gxx-include-dir = / usr / include / c ++ / 4.2.1
无法找到v8官方支持的编译器。
建议使用GCC v4.4或更高版本
使用编译器:g ++
配置:--prefix = / Applications / Xcode.app / Contents / Developer / usr --with- gxx-include-dir = / usr / include / c ++ / 4.2.1
无法找到v8官方支持的编译器。
建议使用GCC v4.4或更高版本
libtool:无法识别的选项`-static'
libtool:尝试`libtool --help'获取更多信息。
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]错误1
make:*** [x64.release]错误2
/Users/me/.rvm/gems/ruby-1.9.3-p125@proj -rails3-ruby19 / gems / libv8-3.16.14.3 / ext / libv8 / location.rb:36:在`block in verify_installation!'中:libv8没有正确安装,期望二进制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,但是从/Users/me/.rvm/gems/ruby-1.9.3-p125@proj-rails3-ruby19/gems/libv8-3.16找不到(Libv8 :: Location :: Vendor :: ArchiveNotFound)
.14.3 / ext / libv8 / location.rb:35:在'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:在`install!'$中b $ b from extconf.rb:7:in< main>'
GYP_GENERATORS = make \
build / gyp / gyp --generator-output =outbuild / 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(目标)/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(目标)/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(目标)/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(目标)/ 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(目标)/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(目标)/Users/me/.rvm/gems/ruby-1.9.3-p125@143.com 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(目标)/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(目标)/Users/me/.rvm/gems/ruby-1.9.3-p125@ PROJ-Rails3中-ruby19 /宝石/ libv8-3.16.14.3 /供应商/ V8 /缩小/ x64.release / obj.target / preparser_lib / SRC / once.o
CXX(目标)/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(目标)/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(目标)/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(目标)/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(目标)/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(目标)/ Us ers/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(目标)/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文件将保留安装在/Users/me/.rvm/gems/ruby-1.9.3-p125 @ proj-rails3-ruby19 / gems / libv8-3.16.14.3进行检查。
记录到/Users/me/.rvm/gems/ruby-1.9.3-p125@proj-rails3-ruby19/gems/libv8-3.16.14.3/ext/libv8/gem_make.out
的结果


解决方案

这是由于OS X 10.9+使用4.8版的GCC。正如拉取请求( https:// github)中所述,这在旧版本的libv8中并不正式支持。 COM / cowboyd / libv8 /拉/ 95 )。请尝试在您的Gemfile中添加libv8的版本(或者) bundle update 就足够了。希望这会有所帮助。



从libv8 自述



携带自己的V8



因为libv8是therubyracer使用的V8引擎的接口,即使您已经安装了V8,也可能需要使用libv8。如果您希望使用自己的V8安装,而不是为您构建,请使用--with-system-v8选项。



使用RubyGems:


gem install libv8 [-v YOUR_VERSION] - --with-system-v8


使用Bundler(在您的Gemfile中):

lockquote
bundle config build.libv8 --with-system- v8


请注意,如果您打算运行自己的V8,则必须同时安装V8及其头文件(可在libv8-dev对于Debian发行版)。



自带编译器



编译器可以通过在编译之前设置CXX环境变​​量,或者通过在bundle配置中添加--with-cxx =选项来实现:


<

编辑:



如果此问题由 therub引入yracer ,请尝试以下建议 rider_on_rails 这里


gem卸载libv8



gem install therubyracer -v YOUR_RUBY_RACER_VERSION



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



I'm trying to install libv8 3.16.14.3 but getting an error on OSX Mavericks using latest stable rvm and ruby-1.9.3-p125.

This is the output of running the command 'gem install 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

解决方案

This is due to the fact that OS X 10.9+ is using version 4.8 of GCC. This is not supported officially in older versions of libv8 as mentioned in the pull request (https://github.com/cowboyd/libv8/pull/95). Please try bumping up the version of libv8 in your Gemfile (or) a bundle update should suffice. Hope this helps.

From the libv8 README

Bring your own V8

Because libv8 is the interface for the V8 engine used by therubyracer, you may need to use libv8, even if you have V8 installed already. If you wish to use your own V8 installation, rather than have it built for you, use the --with-system-v8 option.

Using RubyGems:

gem install libv8 [-v YOUR_VERSION] -- --with-system-v8

Using Bundler (in your Gemfile):

bundle config build.libv8 --with-system-v8

Please note that if you intend to run your own V8, you must install both V8 and its headers (found in libv8-dev for Debian distros).

Bring your own compiler

You can specify a compiler of your choice by either setting the CXX environment variable before compilation, or by adding the --with-cxx= option to the bundle configuration:

bundle config build.libv8 --with-cxx=clang++

Edit:

If this issue is brought on by therubyracer, try the following as suggested by rider_on_rails here:

gem uninstall libv8

gem install therubyracer -v YOUR_RUBY_RACER_VERSION

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

这篇关于在OS X 10.9+上安装libv8 gem的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆