简体   繁体   English

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

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

I am new to mac and tried to bundle install a cloned rails repo. 我是mac的新手,并尝试bundle install克隆的rails repo。 I got an error while installing libv8 gem, googled and found a solution and did 我在安装libv8 gem时遇到了错误,谷歌搜索并找到了解决方案

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

Next I got struck at therebyracer gem, the full trace is as follows 接下来我得到了明智的宝石,完整的痕迹如下

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

I think this is a problem with Mavericks. 我认为这是小牛队的一个问题。

You may want to try what I summarized in this question: "gem install therubyracer -v '0.10.2'" on osx mavericks not installing 您可能想尝试我在这个问题中总结的内容: 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

Let me know if this works! 让我知道这个是否奏效! I've been dealing with the same problem since the launch of Mavericks :) 自从小牛队推出以来,我一直在处理同样的问题:)

Sorry, I don't know what fixed my problem. 对不起,我不知道是什么解决了我的问题。 I was trying everything and it got fixed. 我正在尝试一切,并得到修复。

I installed gcc47 using macports, not homebrew.(it took nearly 2 days to install in my slow 512kbps connection) 我使用macports安装了gcc47,而不是自制软件。(在我的慢速512kbps连接中安装需要将近2天)

Then I changed the version of therubyracer to '0.12.0' 然后我将therubyracer的版本改为'0.12.0'

I don't know which got my problem fixed. 我不知道哪个问题得到解决。

Now after installing v8 try to reinstall ruby. 现在安装v8后尝试重新安装ruby。

rvm reinstall 2.0

And after that install therubyracer with gem install therubyracer 然后安装有gem install therubyracer

I had this same problem when I upgraded from OSX Mountain Lion to OSX Mavericks. 当我从OSX Mountain Lion升级到OSX Mavericks时,我遇到了同样的问题。

Upgrading from ruby-1.8.7-p354 to ruby-1.8.7-375 did the trick for me. 从ruby-1.8.7-p354升级到ruby-1.8.7-375对我来说是个窍门。 Maybe upgrade your ruby 2.0.0-p125 to 2.0.0-rc2 (2.0 is above p353 already) 也许将你的ruby 2.0.0-p125升级到2.0.0-rc2(2.0已高于p353)

if you were using rbenv: 如果你使用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

With thanks to DeLaGuardo 感谢DeLaGuardo

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

相关问题 OS X Mavericks,无法安装libxml-ruby gem? - OS X Mavericks, Cannot install libxml-ruby gem? 在OS X 10.10上,gem install therubyracer -v 0.11.4失败 - gem install therubyracer -v 0.11.4 fails on OS X 10.10 osx mavericks没有安装“gem install therubyracer -v'0.10.2” - “gem install therubyracer -v '0.10.2'” on osx mavericks not installing 使用Ruby On Rails 4.2.5.1,我可以进行gem安装therubyracer,但在OS X 10.11.1上捆绑失败 - With Ruby On Rails 4.2.5.1 I can gem install therubyracer but bundle fails on OS X 10.11.1 捆绑安装 / TheRubyRacer gem 无法安装在 MacOS Catalina 10.15.2 上 - Bundle Install / TheRubyRacer gem cannot be installed on MacOS Catalina 10.15.2 Rails 3-无法在Lion OS X上安装橡胶宝石 - Rails 3 - cannot install rubber gem on Lion OS X 如何在 mac 上安装 therubyracer? “gem install therubyracer -v”不工作 - How to install therubyracer on mac? “gem install therubyracer -v ” not working 无法使用Postgres.app在小牛中安装pg gem - Cannot install pg gem in Mavericks with Postgres.app 在RubyMine中,gem install therubyracer -v&#39;0.12.1&#39;失败 - gem install therubyracer -v '0.12.1' fails in RubyMine 由于therubyracer gem而导致捆绑安装错误 - bundle install error because of therubyracer gem
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM