繁体   English   中英

无法在OS X Mavericks中安装gem'therubyracer'

[英]Cannot install gem 'therubyracer' in OS X Mavericks

我是mac的新手,并尝试bundle install克隆的rails repo。 我在安装libv8 gem时遇到了错误,谷歌搜索并找到了解决方案

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

接下来我得到了明智的宝石,完整的痕迹如下

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

    /Users/anand/.rvm/rubies/ruby-2.0.0-p247/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/anand/.rvm/gems/ruby-2.0.0-p247/gems/libv8-3.16.14.3/vendor/v8/out/x64.release/libpreparser_lib.a] Error 1
make: *** [x64.release] Error 2
/Users/anand/.rvm/gems/ruby-2.0.0-p247/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/anand/.rvm/gems/ruby-2.0.0-p247/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/anand/.rvm/gems/ruby-2.0.0-p247/gems/libv8-3.16.14.3/ext/libv8/location.rb:35:in `each'
    from /Users/anand/.rvm/gems/ruby-2.0.0-p247/gems/libv8-3.16.14.3/ext/libv8/location.rb:35:in `verify_installation!'
    from /Users/anand/.rvm/gems/ruby-2.0.0-p247/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/anand/.rvm/gems/ruby-2.0.0-p247/gems/libv8-3.16.14.3/vendor/v8/out/x64.release/obj.target/preparser_lib/src/allocation.o
  CXX(target) /Users/anand/.rvm/gems/ruby-2.0.0-p247/gems/libv8-3.16.14.3/vendor/v8/out/x64.release/obj.target/preparser_lib/src/atomicops_internals_x86_gcc.o
  CXX(target) /Users/anand/.rvm/gems/ruby-2.0.0-p247/gems/libv8-3.16.14.3/vendor/v8/out/x64.release/obj.target/preparser_lib/src/bignum.o
  CXX(target) /Users/anand/.rvm/gems/ruby-2.0.0-p247/gems/libv8-3.16.14.3/vendor/v8/out/x64.release/obj.target/preparser_lib/src/bignum-dtoa.o
  CXX(target) /Users/anand/.rvm/gems/ruby-2.0.0-p247/gems/libv8-3.16.14.3/vendor/v8/out/x64.release/obj.target/preparser_lib/src/cached-powers.o
  CXX(target) /Users/anand/.rvm/gems/ruby-2.0.0-p247/gems/libv8-3.16.14.3/vendor/v8/out/x64.release/obj.target/preparser_lib/src/conversions.o
  CXX(target) /Users/anand/.rvm/gems/ruby-2.0.0-p247/gems/libv8-3.16.14.3/vendor/v8/out/x64.release/obj.target/preparser_lib/src/diy-fp.o
  CXX(target) /Users/anand/.rvm/gems/ruby-2.0.0-p247/gems/libv8-3.16.14.3/vendor/v8/out/x64.release/obj.target/preparser_lib/src/dtoa.o
  CXX(target) /Users/anand/.rvm/gems/ruby-2.0.0-p247/gems/libv8-3.16.14.3/vendor/v8/out/x64.release/obj.target/preparser_lib/src/fast-dtoa.o
  CXX(target) /Users/anand/.rvm/gems/ruby-2.0.0-p247/gems/libv8-3.16.14.3/vendor/v8/out/x64.release/obj.target/preparser_lib/src/fixed-dtoa.o
  CXX(target) /Users/anand/.rvm/gems/ruby-2.0.0-p247/gems/libv8-3.16.14.3/vendor/v8/out/x64.release/obj.target/preparser_lib/src/once.o
  CXX(target) /Users/anand/.rvm/gems/ruby-2.0.0-p247/gems/libv8-3.16.14.3/vendor/v8/out/x64.release/obj.target/preparser_lib/src/preparse-data.o
  CXX(target) /Users/anand/.rvm/gems/ruby-2.0.0-p247/gems/libv8-3.16.14.3/vendor/v8/out/x64.release/obj.target/preparser_lib/src/preparser.o
  CXX(target) /Users/anand/.rvm/gems/ruby-2.0.0-p247/gems/libv8-3.16.14.3/vendor/v8/out/x64.release/obj.target/preparser_lib/src/preparser-api.o
  CXX(target) /Users/anand/.rvm/gems/ruby-2.0.0-p247/gems/libv8-3.16.14.3/vendor/v8/out/x64.release/obj.target/preparser_lib/src/scanner.o
  CXX(target) /Users/anand/.rvm/gems/ruby-2.0.0-p247/gems/libv8-3.16.14.3/vendor/v8/out/x64.release/obj.target/preparser_lib/src/strtod.o
  CXX(target) /Users/anand/.rvm/gems/ruby-2.0.0-p247/gems/libv8-3.16.14.3/vendor/v8/out/x64.release/obj.target/preparser_lib/src/token.o
  CXX(target) /Users/anand/.rvm/gems/ruby-2.0.0-p247/gems/libv8-3.16.14.3/vendor/v8/out/x64.release/obj.target/preparser_lib/src/unicode.o
  CXX(target) /Users/anand/.rvm/gems/ruby-2.0.0-p247/gems/libv8-3.16.14.3/vendor/v8/out/x64.release/obj.target/preparser_lib/src/utils.o
  LIBTOOL-STATIC /Users/anand/.rvm/gems/ruby-2.0.0-p247/gems/libv8-3.16.14.3/vendor/v8/out/x64.release/libpreparser_lib.a


Gem files will remain installed in /Users/anand/.rvm/gems/ruby-2.0.0-p247/gems/libv8-3.16.14.3 for inspection.
Results logged to /Users/anand/.rvm/gems/ruby-2.0.0-p247/gems/libv8-3.16.14.3/ext/libv8/gem_make.out

我认为这是小牛队的一个问题。

您可能想尝试我在这个问题中总结的内容: osx mavericks上没有安装的“gem install therubyracer -v'0.10.2”

brew install apple-gcc42

sudo ln -s /usr/local/Cellar/apple-gcc42/4.2.1-5666.3/bin/gcc-4.2 /usr/bin/gcc 
sudo ln -s /usr/local/Cellar/apple-gcc42/4.2.1-5666.3/bin/g++-4.2 /usr/bin/g++ 
sudo ln -s /usr/local/Cellar/apple-gcc42/4.2.1-5666.3/bin/cpp-4.2 /usr/bin/cpp

brew uninstall v8 (only in case you installed it with brew)
gem install libv8
gem install therubyracer

让我知道这个是否奏效! 自从小牛队推出以来,我一直在处理同样的问题:)

对不起,我不知道是什么解决了我的问题。 我正在尝试一切,并得到修复。

我使用macports安装了gcc47,而不是自制软件。(在我的慢速512kbps连接中安装需要将近2天)

然后我将therubyracer的版本改为'0.12.0'

我不知道哪个问题得到解决。

现在安装v8后尝试重新安装ruby。

rvm reinstall 2.0

然后安装有gem install therubyracer

当我从OSX Mountain Lion升级到OSX Mavericks时,我遇到了同样的问题。

从ruby-1.8.7-p354升级到ruby-1.8.7-375对我来说是个窍门。 也许将你的ruby 2.0.0-p125升级到2.0.0-rc2(2.0已高于p353)

如果你使用rbenv:

rbenv install 2.0.0-rc2
rbenv rehash
rbenv shell 2

bundle install
gem uninstall libv8
brew rm v8
brew tap homebrew/dupes
brew install apple-gcc42
brew tap homebrew/versions
brew install v8-315
brew link --force v8-315
gem install libv8 -- --with-system-v8
gem install therubyracer

感谢DeLaGuardo

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM