无法安装therubyracer

时间:2013-05-19 15:23:12

标签: ruby ruby-on-rails-3 gem

我最近从github派了一个存储库,然而,当我尝试运行“bundle install”时,我得到以下错误输出:

Robert-Quinns-MacBook-Pro:~ robertquinn$ gem install therubyracer

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

        /Users/robertquinn/.rvm/rubies/ruby-1.9.3-p194/bin/ruby extconf.rb
creating Makefile
Compiling v8 for x64
Using python 2.5.4
Unable to find a compiler officially supported by v8.
It is recommended to use GCC v4.4 or higher
Using compiler: g++
Unable to find a compiler officially supported by v8.
It is recommended to use GCC v4.4 or higher
  File "./gyp-mac-tool", line 167
    fd = os.open(lockfile, os.O_RDONLY|os.O_NOCTTY|os.O_CREAT, 0o666)
                                                                   ^
SyntaxError: invalid syntax
make[1]: *** [/Users/robertquinn/.rvm/gems/ruby-1.9.3-p194/gems/libv8-3.11.8.17/vendor/v8/out/x64.release/libpreparser_lib.a] Error 1
make: *** [x64.release] Error 2
/Users/robertquinn/.rvm/gems/ruby-1.9.3-p194/gems/libv8-3.11.8.17/ext/libv8/location.rb:36:in `block in verify_installation!': libv8 did not install properly, expected binary v8 archive '/Users/robertquinn/.rvm/gems/ruby-1.9.3-p194/gems/libv8-3.11.8.17/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/robertquinn/.rvm/gems/ruby-1.9.3-p194/gems/libv8-3.11.8.17/ext/libv8/location.rb:35:in `each'
    from /Users/robertquinn/.rvm/gems/ruby-1.9.3-p194/gems/libv8-3.11.8.17/ext/libv8/location.rb:35:in `verify_installation!'
    from /Users/robertquinn/.rvm/gems/ruby-1.9.3-p194/gems/libv8-3.11.8.17/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_can_use_vfp_instructions=true
  CXX(target) /Users/robertquinn/.rvm/gems/ruby-1.9.3-p194/gems/libv8-3.11.8.17/vendor/v8/out/x64.release/obj.target/preparser_lib/src/allocation.o
  CXX(target) /Users/robertquinn/.rvm/gems/ruby-1.9.3-p194/gems/libv8-3.11.8.17/vendor/v8/out/x64.release/obj.target/preparser_lib/src/atomicops_internals_x86_gcc.o
  CXX(target) /Users/robertquinn/.rvm/gems/ruby-1.9.3-p194/gems/libv8-3.11.8.17/vendor/v8/out/x64.release/obj.target/preparser_lib/src/bignum.o
  CXX(target) /Users/robertquinn/.rvm/gems/ruby-1.9.3-p194/gems/libv8-3.11.8.17/vendor/v8/out/x64.release/obj.target/preparser_lib/src/bignum-dtoa.o
  CXX(target) /Users/robertquinn/.rvm/gems/ruby-1.9.3-p194/gems/libv8-3.11.8.17/vendor/v8/out/x64.release/obj.target/preparser_lib/src/cached-powers.o
  CXX(target) /Users/robertquinn/.rvm/gems/ruby-1.9.3-p194/gems/libv8-3.11.8.17/vendor/v8/out/x64.release/obj.target/preparser_lib/src/conversions.o
  CXX(target) /Users/robertquinn/.rvm/gems/ruby-1.9.3-p194/gems/libv8-3.11.8.17/vendor/v8/out/x64.release/obj.target/preparser_lib/src/diy-fp.o
  CXX(target) /Users/robertquinn/.rvm/gems/ruby-1.9.3-p194/gems/libv8-3.11.8.17/vendor/v8/out/x64.release/obj.target/preparser_lib/src/dtoa.o
  CXX(target) /Users/robertquinn/.rvm/gems/ruby-1.9.3-p194/gems/libv8-3.11.8.17/vendor/v8/out/x64.release/obj.target/preparser_lib/src/fast-dtoa.o
  CXX(target) /Users/robertquinn/.rvm/gems/ruby-1.9.3-p194/gems/libv8-3.11.8.17/vendor/v8/out/x64.release/obj.target/preparser_lib/src/fixed-dtoa.o
  CXX(target) /Users/robertquinn/.rvm/gems/ruby-1.9.3-p194/gems/libv8-3.11.8.17/vendor/v8/out/x64.release/obj.target/preparser_lib/src/once.o
  CXX(target) /Users/robertquinn/.rvm/gems/ruby-1.9.3-p194/gems/libv8-3.11.8.17/vendor/v8/out/x64.release/obj.target/preparser_lib/src/preparse-data.o
  CXX(target) /Users/robertquinn/.rvm/gems/ruby-1.9.3-p194/gems/libv8-3.11.8.17/vendor/v8/out/x64.release/obj.target/preparser_lib/src/preparser.o
  CXX(target) /Users/robertquinn/.rvm/gems/ruby-1.9.3-p194/gems/libv8-3.11.8.17/vendor/v8/out/x64.release/obj.target/preparser_lib/src/preparser-api.o
  CXX(target) /Users/robertquinn/.rvm/gems/ruby-1.9.3-p194/gems/libv8-3.11.8.17/vendor/v8/out/x64.release/obj.target/preparser_lib/src/scanner.o
  CXX(target) /Users/robertquinn/.rvm/gems/ruby-1.9.3-p194/gems/libv8-3.11.8.17/vendor/v8/out/x64.release/obj.target/preparser_lib/src/strtod.o
  CXX(target) /Users/robertquinn/.rvm/gems/ruby-1.9.3-p194/gems/libv8-3.11.8.17/vendor/v8/out/x64.release/obj.target/preparser_lib/src/token.o
  CXX(target) /Users/robertquinn/.rvm/gems/ruby-1.9.3-p194/gems/libv8-3.11.8.17/vendor/v8/out/x64.release/obj.target/preparser_lib/src/unicode.o
  CXX(target) /Users/robertquinn/.rvm/gems/ruby-1.9.3-p194/gems/libv8-3.11.8.17/vendor/v8/out/x64.release/obj.target/preparser_lib/src/utils.o
  LIBTOOL-STATIC /Users/robertquinn/.rvm/gems/ruby-1.9.3-p194/gems/libv8-3.11.8.17/vendor/v8/out/x64.release/libpreparser_lib.a


Gem files will remain installed in /Users/robertquinn/.rvm/gems/ruby-1.9.3-p194/gems/libv8-3.11.8.17 for inspection.
Results logged to /Users/robertquinn/.rvm/gems/ruby-1.9.3-p194/gems/libv8-3.11.8.17/ext/libv8/gem_make.out
Robert-Quinns-MacBook-Pro:~ robertquinn$ 
Robert-Quinns-MacBook-Pro:~ robertquinn$ 

以下是我尝试过的一些事情:

gem uninstall libv8
brew install v8
gem install therubyracer

以及:

RUBYOPT=-rrubygems gem install therubyracer

有什么想法吗?

修改

输入以下命令后:

$ brew tap homebrew/dupes
$ brew install apple-gcc42

以下是完整输出,包括这些命令的结果:

Robert-Quinns-MacBook-Pro:~ robertquinn$ brew tap homebrew/dupes
Cloning into /usr/local/Library/Taps/homebrew-dupes...
remote: Counting objects: 894, done.
remote: Compressing objects: 100% (488/488), done.
remote: Total 894 (delta 491), reused 795 (delta 406)
Receiving objects: 100% (894/894), 154.86 KiB | 235 KiB/s, done.
Resolving deltas: 100% (491/491), done.
Tapped 41 formula
Robert-Quinns-MacBook-Pro:~ robertquinn$ brew install apple-gcc42
==> Downloading http://r.research.att.com/tools/gcc-42-5666.3-darwin11.pkg
######################################################################## 100.0%
==> Caveats
NOTE:
This formula provides components that were removed from XCode in the 4.2
release. There is no reason to install this formula if you are using a
version of XCode prior to 4.2.

This formula contains compilers built from Apple's GCC sources, build
5666.3, available from:

  http://opensource.apple.com/tarballs/gcc

All compilers have a `-4.2` suffix. A GFortran compiler is also included.
==> Summary
/usr/local/Cellar/apple-gcc42/4.2.1-5666.3: 104 files, 75M, built in 110 seconds
Robert-Quinns-MacBook-Pro:~ robertquinn$ gem install therubyracer
Building native extensions.  This could take a while...
ERROR:  Error installing therubyracer:
    ERROR: Failed to build gem native extension.

        /Users/robertquinn/.rvm/rubies/ruby-1.9.3-p194/bin/ruby extconf.rb
creating Makefile
Compiling v8 for x64
Using python 2.5.4
Unable to find a compiler officially supported by v8.
It is recommended to use GCC v4.4 or higher
Using compiler: g++
Unable to find a compiler officially supported by v8.
It is recommended to use GCC v4.4 or higher
  File "./gyp-mac-tool", line 167
    fd = os.open(lockfile, os.O_RDONLY|os.O_NOCTTY|os.O_CREAT, 0o666)
                                                                   ^
SyntaxError: invalid syntax
make[1]: *** [/Users/robertquinn/.rvm/gems/ruby-1.9.3-p194/gems/libv8-3.11.8.17/vendor/v8/out/x64.release/libpreparser_lib.a] Error 1
make: *** [x64.release] Error 2
/Users/robertquinn/.rvm/gems/ruby-1.9.3-p194/gems/libv8-3.11.8.17/ext/libv8/location.rb:36:in `block in verify_installation!': libv8 did not install properly, expected binary v8 archive '/Users/robertquinn/.rvm/gems/ruby-1.9.3-p194/gems/libv8-3.11.8.17/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/robertquinn/.rvm/gems/ruby-1.9.3-p194/gems/libv8-3.11.8.17/ext/libv8/location.rb:35:in `each'
    from /Users/robertquinn/.rvm/gems/ruby-1.9.3-p194/gems/libv8-3.11.8.17/ext/libv8/location.rb:35:in `verify_installation!'
    from /Users/robertquinn/.rvm/gems/ruby-1.9.3-p194/gems/libv8-3.11.8.17/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_can_use_vfp_instructions=true
  CXX(target) /Users/robertquinn/.rvm/gems/ruby-1.9.3-p194/gems/libv8-3.11.8.17/vendor/v8/out/x64.release/obj.target/preparser_lib/src/allocation.o
  CXX(target) /Users/robertquinn/.rvm/gems/ruby-1.9.3-p194/gems/libv8-3.11.8.17/vendor/v8/out/x64.release/obj.target/preparser_lib/src/atomicops_internals_x86_gcc.o
  CXX(target) /Users/robertquinn/.rvm/gems/ruby-1.9.3-p194/gems/libv8-3.11.8.17/vendor/v8/out/x64.release/obj.target/preparser_lib/src/bignum.o
  CXX(target) /Users/robertquinn/.rvm/gems/ruby-1.9.3-p194/gems/libv8-3.11.8.17/vendor/v8/out/x64.release/obj.target/preparser_lib/src/bignum-dtoa.o
  CXX(target) /Users/robertquinn/.rvm/gems/ruby-1.9.3-p194/gems/libv8-3.11.8.17/vendor/v8/out/x64.release/obj.target/preparser_lib/src/cached-powers.o
  CXX(target) /Users/robertquinn/.rvm/gems/ruby-1.9.3-p194/gems/libv8-3.11.8.17/vendor/v8/out/x64.release/obj.target/preparser_lib/src/conversions.o
  CXX(target) /Users/robertquinn/.rvm/gems/ruby-1.9.3-p194/gems/libv8-3.11.8.17/vendor/v8/out/x64.release/obj.target/preparser_lib/src/diy-fp.o
  CXX(target) /Users/robertquinn/.rvm/gems/ruby-1.9.3-p194/gems/libv8-3.11.8.17/vendor/v8/out/x64.release/obj.target/preparser_lib/src/dtoa.o
  CXX(target) /Users/robertquinn/.rvm/gems/ruby-1.9.3-p194/gems/libv8-3.11.8.17/vendor/v8/out/x64.release/obj.target/preparser_lib/src/fast-dtoa.o
  CXX(target) /Users/robertquinn/.rvm/gems/ruby-1.9.3-p194/gems/libv8-3.11.8.17/vendor/v8/out/x64.release/obj.target/preparser_lib/src/fixed-dtoa.o
  CXX(target) /Users/robertquinn/.rvm/gems/ruby-1.9.3-p194/gems/libv8-3.11.8.17/vendor/v8/out/x64.release/obj.target/preparser_lib/src/once.o
  CXX(target) /Users/robertquinn/.rvm/gems/ruby-1.9.3-p194/gems/libv8-3.11.8.17/vendor/v8/out/x64.release/obj.target/preparser_lib/src/preparse-data.o
  CXX(target) /Users/robertquinn/.rvm/gems/ruby-1.9.3-p194/gems/libv8-3.11.8.17/vendor/v8/out/x64.release/obj.target/preparser_lib/src/preparser.o
  CXX(target) /Users/robertquinn/.rvm/gems/ruby-1.9.3-p194/gems/libv8-3.11.8.17/vendor/v8/out/x64.release/obj.target/preparser_lib/src/preparser-api.o
  CXX(target) /Users/robertquinn/.rvm/gems/ruby-1.9.3-p194/gems/libv8-3.11.8.17/vendor/v8/out/x64.release/obj.target/preparser_lib/src/scanner.o
  CXX(target) /Users/robertquinn/.rvm/gems/ruby-1.9.3-p194/gems/libv8-3.11.8.17/vendor/v8/out/x64.release/obj.target/preparser_lib/src/strtod.o
  CXX(target) /Users/robertquinn/.rvm/gems/ruby-1.9.3-p194/gems/libv8-3.11.8.17/vendor/v8/out/x64.release/obj.target/preparser_lib/src/token.o
  CXX(target) /Users/robertquinn/.rvm/gems/ruby-1.9.3-p194/gems/libv8-3.11.8.17/vendor/v8/out/x64.release/obj.target/preparser_lib/src/unicode.o
  CXX(target) /Users/robertquinn/.rvm/gems/ruby-1.9.3-p194/gems/libv8-3.11.8.17/vendor/v8/out/x64.release/obj.target/preparser_lib/src/utils.o
  LIBTOOL-STATIC /Users/robertquinn/.rvm/gems/ruby-1.9.3-p194/gems/libv8-3.11.8.17/vendor/v8/out/x64.release/libpreparser_lib.a


Gem files will remain installed in /Users/robertquinn/.rvm/gems/ruby-1.9.3-p194/gems/libv8-3.11.8.17 for inspection.
Results logged to /Users/robertquinn/.rvm/gems/ruby-1.9.3-p194/gems/libv8-3.11.8.17/ext/libv8/gem_make.out
Robert-Quinns-MacBook-Pro:~ robertquinn$ 

1 个答案:

答案 0 :(得分:2)

由于您的系统上没有编译器,因此失败了。

安装gcc编译器

例如:https://github.com/kennethreitz/osx-gcc-installer

或(自制):

$ brew tap homebrew/dupes
$ brew install apple-gcc42
相关问题