不能用RVM-GCC问题在Lion下安装Ruby

不能用RVM-GCC问题在Lion下安装Ruby

有关这个问题的大多数问题都是由于缺少Xcode造成的;我已经安装了Xcode 4.2。

安装尝试:

rvm install 1.9.3Installing Ruby from source to: /Users/jamie/.rvm/rubies/ruby-1.9.3-p0, this may take a while depending on your cpu(s)...ruby-1.9.3-p0 - #fetching ruby-1.9.3-p0 - #extracted to /Users/jamie/.rvm/src/ruby-1.9.3-p0 (already extracted)Fetching yaml-0.1.4.tar.gz to /Users/jamie/.rvm/archivesExtracting yaml-0.1.4.tar.gz to /Users/jamie/.rvm/srcConfiguring yaml in /Users/jamie/.rvm/src/yaml-0.1.4.Compiling yaml in /Users/jamie/.rvm/src/yaml-0.1.4.Installing yaml to /Users/jamie/.rvm/usr
ruby-1.9.3-p0 - #configuring ERROR: Error running ' ./configure --prefix=/Users/jamie/.rvm/rubies/ruby-1.9.3-p0 --enable-shared --disable-install-doc --with-libyaml-dir=/Users/jamie/.rvm/usr ', please read /Users/jamie/.rvm/log/ruby-1.9.3-p0/configure.log
ERROR: There has been an error while running configure. Halting the installation.

配置.log:

[2011-11-07 04:32:17]  ./configure --prefix=/Users/jamie/.rvm/rubies/ruby-1.9.3-p0 --enable-shared --disable-install-doc --with-libyaml-dir=/Users/jamie/.rvm/usr 
configure: WARNING: unrecognized options: --with-libyaml-dir
checking build system type... x86_64-apple-darwin11.2.0checking host system type... x86_64-apple-darwin11.2.0checking target system type... x86_64-apple-darwin11.2.0checking whether the C compiler works... noconfigure: error: in `/Users/jamie/.rvm/src/ruby-1.9.3-p0':
configure: error: C compiler cannot create executables
See `config.log' for more details


慕丝7291255
浏览 692回答 3
3回答

智慧大石

这个答案经过多次编辑,现在包含了几个替代解决办法。先试试简单的“编辑3”解决方案。Ruby1.9.3-p 125及以后版本对clang的官方支持所以如果你安装这样一个版本,你不应该需要GCC。如果您正在安装一个旧版本的Ruby,请继续阅读。要用GCC编译Ruby,需要一个没有LLVM版本的GCC,它不再包含在XCode 4.2中。自己安装(或暂时降级到XCode 4.1),然后执行CC=/usr/local/bin/gcc-4.2 rvm install 1.9.3 --enable-shared(替代通往非LLVM GCC的道路)。编辑:https:/github.com/kenneresitz/OSX-GCC-Installer/下载可能有助于安装GCC。还可以通过运行rvm requirements.编辑2:为了更简单的解决方案,您可以尝试添加--with-gcc=clang的论点configure红宝石用clang代替GCC。编辑3: rvm install 1.9.3 --with-gcc=clang为你这么做。注意:对于当前版本的XCode,您需要在XCode菜单->Preferences->Download->Components中分别安装命令行工具。这是在命令行上使用XCode进行任何编译的先决条件,而不仅仅是Ruby。注2:如果某些东西在执行这些步骤后不起作用,请尝试重新启动或重新登录,以确保环境设置正确。注3:1.9.3-p 125之前的Ruby版本可能并不总是与clang完全兼容,所以如果在生产环境中使用“编辑3”解决方案,请彻底测试软件。
打开App,查看更多内容
随时随地看视频慕课网APP