2013-05-14 130 views
2

所以,我的客户让我工作在运行Rails 2.3.8和Ruby 1.8.7的遗留应用程序,所以我试图安装使用rbenv红宝石的正确版本,但它不断给我这个错误:rbenv安装失败(告诉我安装GCC,但它已经安装)

→ rbenv install 1.8.7-p249 

ERROR: This package must be compiled with GCC, but ruby-build couldn't 
find a suitable `gcc` executable on your system. Please install GCC 
and try again. 

DETAILS: Apple no longer includes the official GCC compiler with Xcode 
as of version 4.2. Instead, the `gcc` executable is a symlink to 
`llvm-gcc`, a modified version of GCC which outputs LLVM bytecode. 

For most programs the `llvm-gcc` compiler works fine. However, 
versions of Ruby older than 1.9.3-p125 are incompatible with 
`llvm-gcc`. To build older versions of Ruby you must have the official 
GCC compiler installed on your system. 


TO FIX THE PROBLEM: Install the official GCC compiler using these 
packages: https://github.com/kennethreitz/osx-gcc-installer/downloads 

You will need to install the official GCC compiler to build older 
versions of Ruby even if you have installed Apple's Command Line Tools 
for Xcode package. The Command Line Tools for Xcode package only 
includes `llvm-gcc`. 

BUILD FAILED 

当我检查,看看我是否有GCC,它表明我做的:

→ which gcc 
/usr/bin/gcc 

→ gcc -v 

Using built-in specs. 
Target: i686-apple-darwin11 
Configured with: /private/var/tmp/llvmgcc42/llvmgcc42-2336.11~148/src/configure --disable- checking --enable-werror --prefix=/Applications/Xcode.app/Contents/Developer/usr/llvm-gcc-4.2 --mandir=/share/man --enable-languages=c,objc,c++,obj-c++ --program-prefix=llvm- --program-transform-name=/^[cg][^.-]*$/s/$/-4.2/ --with-slibdir=/usr/lib --build=i686-apple-darwin11 --enable-llvm=/private/var/tmp/llvmgcc42/llvmgcc42-2336.11~148/dst-llvmCore/Developer/usr/local --program-prefix=i686-apple-darwin11- --host=x86_64-apple-darwin11 --target=i686-apple-darwin11 --with-gxx-include-dir=/usr/include/c++/4.2.1 
Thread model: posix 
gcc version 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.11.00) 

我已更新rbenv。不知道还有什么要做。

+0

我发现了与RVM类似的问题,不确定它们是否相关,但我会尝试一些解决方案:http://stackoverflow.com/questions/8032824/cant-install-ruby-under-lion -with-RVM-GCC-问题?RQ = 1 – jarodtaylor

回答

1

这就是我没有彻底读完整个错误所得到的结果。 :)

我已经安装了llvmgcc42而不是gcc。我需要GCC来使用旧版本的Ruby。