【问题标题】:Error when upgrading to Ruby2.0 [closed]升级到 Ruby2.0 时出错 [关闭]
【发布时间】:2026-02-06 11:20:03
【问题描述】:

基本上,当尝试按照以下说明安装 Ruby2.0 时:http://architects.dzone.com/articles/upgrading-ruby-20-mountain 我碰壁了。

具体到这一步:“rvm install 2.0.0”

我收到以下错误:

Error running 'env LDFLAGS=-L/opt/sm/pkg/active/lib CFLAGS=-I/opt/sm/pkg/active/include CPATH=/opt/sm/pkg/active/include ./configure --prefix=/usr/local/rvm/rubies/ruby-2.0.0-p195 --with-opt-dir=/opt/sm/pkg/active --disable-install-doc --without-tcl --without-tk --enable-shared',
please read /usr/local/rvm/log/ruby-2.0.0-p195/1370731952_configure.log
There has been an error while running configure. Halting the installation.

当按照命令提示符指令读取“/usr/local/rvm/log/ruby-2.0.0-p195/1370731952_configure.log”时

configure.log 文件:

[2013-06-08 18:52:32] ./configure
current path: /usr/local/rvm/src/ruby-2.0.0-p195
command(9): env LDFLAGS=-L/opt/sm/pkg/active/lib CFLAGS=-I/opt/sm/pkg/active/include CPATH=/opt/sm/pkg/active/include ./configure --prefix=/usr/local/rvm/rubies/ruby-2.0.0-p195 --with-opt-dir=/opt/sm/pkg/active --disable-install-doc --without-tcl --without-tk --enable-shared
configure: WARNING: unrecognized options: --without-tcl, --without-tk
checking build system type... x86_64-apple-darwin12.3.0
checking host system type... x86_64-apple-darwin12.3.0
checking target system type... x86_64-apple-darwin12.3.0
checking whether the C compiler works... no
configure: error: in `/usr/local/rvm/src/ruby-2.0.0-p195':
configure: error: C compiler cannot create executables
See `config.log' for more details

请指教

【问题讨论】:

  • config.log 文件(在底部提到)是否告诉您 C 编译器无法创建可执行文件的原因?
  • 你安装了 C 编译器吗?
  • 嗯..大概我没有安装C编译器?我以为它随 OSX 一起提供,但我可能错了。
  • 刚查了一下,我确实安装了包括C编译器在内的命令工具。

标签: ruby-on-rails ruby homebrew ruby-2.0


【解决方案1】:

嗯,关键错误消息是configure: error: C compiler cannot create executables。您是否找到并查看了config.log(不同于configure.log)?仔细检查您是否不仅安装了Xcode,还安装了command line tools

【讨论】:

  • 谢谢,我刚刚检查了我的 XCode 首选项/下载,并且命令行工具被列为已安装。所以在这种情况下这不是问题,不太确定什么是诚实的。任何帮助将不胜感激。
  • 您是否找到并查看了 config.log(不同于 configure.log)?它说了什么?
  • 得到它的工作 - 不知道如何......但它现在工作,呵呵。我会接受你的回答!