6

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

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

接下来我被击中了thoseracer gem,完整的痕迹如下

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

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

4

5 回答 5

5

您可能想尝试我在这个问题中总结的内容:"gem install therubyracer -v '0.10.2'" on osx mavericks not installed

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

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

于 2013-11-04T07:05:00.077 回答
5

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

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

然后我将 therubyracer 的版本更改为“0.12.0”

我不知道哪个解决了我的问题。

于 2013-11-04T08:38:06.930 回答
1

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

rvm reinstall 2.0

然后安装 therubyracergem install therubyracer

于 2013-10-31T04:26:39.990 回答
0

当我从 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
于 2014-04-05T03:18:36.193 回答
-1
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

于 2015-11-02T10:03:18.653 回答