2012-05-30 124 views
1

顶部当运行rbenv install 1.9.2-p320,我得到下面的输出:OSX-GCC-安装过Xcode的

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 .

我已经得到的Xcode 4.3.2安装。我可以安全地在顶部安装osx-gcc-installer - 这既能解决上述问题,又能让Xcode在iOS开发中顺利运行?

在此先感谢。

回答

4

这不是一般的安全在Xcode的顶部安装该软件包。它专为需要编译器及其依赖项而无需安装Xcode的人设计。如果你已经安装了Xcode的命令行工具,它会覆盖很多文件,并可能会破坏所有类型的东西。

如果你只关心iOS开发,你不需要命令行工具Xcode的好,所以也没什么关系,即使他们是彻底打破。但是在那种情况下,你最好不要安装这些命令行工具,而是试图安装两者。

一个更安全的替代方法是安装的地方在/ usr其他的编译器。你明显可以通过自己来构建它,但这是很多工作。您可能需要查看Brew apple-gcc42软件包,该软件包专门设计用于补充Xcode 4.2 +的命令行工具,方法是添加缺少的工具(全部位于/ usr/local/bin而不是/ usr/bin,以及后缀-4.2)。或者,如果您已经使用MacPorts或Fink,请尝试使用其包装。 (如果你需要帮助,告诉不同的软件包使用/usr/local/bin/gcc-4.2而不是/ usr/bin/gcc等,你应该问一个新问题。)

另一个明显的选择是使用Ruby 1.9.3,它没有这个问题,而不是1.9.2。 (如果你不想进入自己打造的事情的细节多毛,酿造有了这样一个软件包内,太...)

+0

哇,非常感谢您的信息的答案! –