【问题标题】:Error when updating my Ruby version using RVM on Mac OS X 10.6.6在 Mac OS X 10.6.6 上使用 RVM 更新我的 Ruby 版本时出错
【发布时间】:2011-02-08 18:57:17
【问题描述】:

我尝试在我的 Mac OS X 10.6.6 系统中更新 Ruby。现在我有 1.8.7,我想更新到 1.9.2。 当我输入rvm install 1.9.2 时,我得到了:

gal-harths-iMac:~ galharth$ rvm install 1.9.2
/Users/galharth/.rvm/rubies/ruby-1.9.2-p136, this may take a while depending on your cpu(s)...

ruby-1.9.2-p136 - #fetching 
ruby-1.9.2-p136 - #extracted to /Users/galharth/.rvm/src/ruby-1.9.2-p136 (already extracted)
ruby-1.9.2-p136 - #configuring 
Error running ' ./configure --prefix=/Users/galharth/.rvm/rubies/ruby-1.9.2-p136 --enable-shared  ', please read /Users/galharth/.rvm/log/ruby-1.9.2-p136/configure.log
There has been an error while running configure. Halting the installation.

我安装了 XCode,但还是不行。

这是 configure.log 文件:

[2011-02-08 17:10:04]  ./configure --prefix=/Users/galharth/.rvm/rubies/ruby-1.9.2-p136 --enable-shared  
checking build system type... i386-apple-darwin10.6.0
checking host system type... i386-apple-darwin10.6.0
checking target system type... i386-apple-darwin10.6.0
checking for gcc... no
checking for cc... no
checking for cl.exe... no
configure: error: in `/Users/galharth/.rvm/src/ruby-1.9.2-p136':
configure: error: no acceptable C compiler found in $PATH
See `config.log' for more details
[2011-02-08 17:23:19]  ./configure --prefix=/Users/galharth/.rvm/rubies/ruby-1.9.2-p136 --enable-shared  
checking build system type... i386-apple-darwin10.6.0
checking host system type... i386-apple-darwin10.6.0
checking target system type... i386-apple-darwin10.6.0
checking for gcc... no
checking for cc... no
checking for cl.exe... no
configure: error: in `/Users/galharth/.rvm/src/ruby-1.9.2-p136':
configure: error: no acceptable C compiler found in $PATH
See `config.log' for more details
[2011-02-08 20:44:14]  ./configure --prefix=/Users/galharth/.rvm/rubies/ruby-1.9.2-p136 --enable-shared  
checking build system type... i386-apple-darwin10.6.0
checking host system type... i386-apple-darwin10.6.0
checking target system type... i386-apple-darwin10.6.0
checking for gcc... no
checking for cc... no
checking for cl.exe... no
configure: error: in `/Users/galharth/.rvm/src/ruby-1.9.2-p136':
configure: error: no acceptable C compiler found in $PATH
See `config.log' for more details
[2011-02-08 21:02:55]  ./configure --prefix=/Users/galharth/.rvm/rubies/ruby-1.9.2-p136 --enable-shared  
checking build system type... i386-apple-darwin10.6.0
checking host system type... i386-apple-darwin10.6.0
checking target system type... i386-apple-darwin10.6.0
checking for gcc... no
checking for cc... no
checking for cl.exe... no
configure: error: in `/Users/galharth/.rvm/src/ruby-1.9.2-p136':
configure: error: no acceptable C compiler found in $PATH
See `config.log' for more details

【问题讨论】:

  • 您是否按照错误消息的指示进行操作并阅读/Users/galharth/.rvm/log/ruby-1.9.2-p136/configure.log?它说明了什么?
  • 10x 的评论我编辑了我的问题,并添加了 configure.log 文件..
  • 您能否在命令行中包含echo $PATH 和which gcc 的输出?
  • Xcode 只是一个 IDE;你需要一个 C 编译器。 gcc 附带 Mac OS X 开发者工具,因此请尝试下载。
  • XCode是开发环境的名称,包括编译器、make、所有头文件等。下载安装XCode会安装所有的开发工具。

标签: ruby macos rvm


【解决方案1】:

您的日志文件输出中有一些奇怪的地方。您的问题显示您有 Mac OS 10.6.6,但日志显示操作系统是 i386。 Mac OS 10.6.6 应该是 x86_64。这意味着由于某种原因您的系统认为它是 32 位的,而它应该是 64 位。您的XCode 版本必须是最新的,所以如果您不只是下载并安装它,那么就这样做。 Snow Leopard 磁盘上的XCode 版本有问题,并且在您的机器上安装 10.6 后,Snow Leopard 之前的 Mac OS 版本已过期。

这里有一些东西可以尝试。如果一个有效,你就完成了,否则尝试下一个。

  1. 如果更新后显示的版本号发生变化,请输入rvm -v 并记下版本号,然后rvm get head 后跟rvm reload。尝试运行rvm install 1.9.2-p136。
  2. 使用rm ~/.rvm/src/ruby-1.9.2-p136 删除~/.rvm/src/ruby-1.9.2-p136 目录中的文件,然后尝试使用#1 中的安装命令进行安装。
  3. 手动将Ruby 1.9.2-p136 的副本下载到您的~/.rvm/archives 目录中,然后将其解压缩到您的~/.rvm/src/ruby-1.9.2-p136 目录中。您可以cd ~/.rvm/archives,删除任何现有的旧版本存档,然后使用curl -O @987654324@ 或wget @987654325@ 拉入新版本。然后是cd ~/.rvm/src,然后是上面#2 中的rm 命令,然后是tar zxvf ../archives/ruby-1.9.2-p136.tar.gz 以提取文件,然后尝试在#1 中运行RVM install 命令。

我有一台位于代理后面的机器,它不允许 RVM 访问 Ruby 存储库,导致存档实际上是代理的失败通知。当 RVM 尝试破坏 tar 文件时,它会失败,但没有发现问题,然后会尝试配置并失败。解决方法是手动下载存档并将其放入src 目录。

【讨论】:

    【解决方案2】:

    使用命令 rvm install 1.9.3 --with-gcc=clang 对我有用。

    【讨论】:

      【解决方案3】:

      当我遇到这种情况时,我插入了 Snow Leopard 磁盘,选择了 Optional Installs 并安装了 Xcode 包。如此处所述,这解决了缺少的 C 编译器问题。感谢这个博客:http://www.brianp.net/2009/09/05/snow-leopards-ate-my-c-compiler/

      就我而言,一旦我解决了编译器问题,就会出现权限错误。在 bash 中以 root 身份运行为 rvm 提供了适当的权限。

      【讨论】:

        【解决方案4】:

        如果您正在运行 Lion,请检查以确保您已安装命令行工具。他们将它们与 XCode 分开,因此它们现在是单独的下载。你可以在这里找到它们:

        https://developer.apple.com/downloads/index.action

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 2011-06-27
          • 1970-01-01
          • 2011-07-01
          • 2011-11-04
          • 1970-01-01
          相关资源
          最近更新 更多