【问题标题】:Mountain Lion rvm force reinstall errorMountain Lion rvm强制重新安装错误
【发布时间】:2012-11-11 03:39:33
【问题描述】:

尝试使用 rvm 重新安装 ruby​​ 并遇到此错误:

rvm reinstall all --force
Removing /usr/local/rvm/src/ruby-1.9.3-p194...
Removing /usr/local/rvm/rubies/ruby-1.9.3-p194...
No binary rubies available for: osx/10.8/x86_64/ruby-1.9.3-p194.
Continuing with compilation. Please read 'rvm mount' to get more information on binary rubies.
Installing Ruby from source to: /usr/local/rvm/rubies/ruby-1.9.3-p194, this may take a while depending on your cpu(s)...
ruby-1.9.3-p194 - #downloading ruby-1.9.3-p194, this may take a while depending on your connection...
ruby-1.9.3-p194 - #extracting ruby-1.9.3-p194 to /usr/local/rvm/src/ruby-1.9.3-p194
ruby-1.9.3-p194 - #extracted to /usr/local/rvm/src/ruby-1.9.3-p194
ruby-1.9.3-p194 - #configuring
Error running 'env LDFLAGS=-L/opt/sm/pkg/active/lib CFLAGS=-I/opt/sm/pkg/active/include CPATH=/opt/sm/pkg/active/include -L/usr/local/rvm/usr/lib ./configure --enable-shared --disable-install-doc --prefix=/usr/local/rvm/rubies/ruby-1.9.3-p194', please read /usr/local/rvm/log/ruby-1.9.3-p194/configure.log
There has been an error while running configure. Halting the installation.

我能做些什么来解决这个问题?提前致谢。

错误信息:

cat /usr/local/rvm/log/ruby-1.9.3-p194/configure.log
[2012-11-22 09:39:59] env LDFLAGS=-L/opt/sm/pkg/active/lib CFLAGS=-I/opt/sm/pkg/active/include CPATH=/opt/sm/pkg/active/include -L/usr/local/rvm/usr/lib ./configure --enable-shared --disable-install-doc --prefix=/usr/local/rvm/rubies/ruby-1.9.3-p194
checking build system type... x86_64-apple-darwin12.2.0
checking host system type... x86_64-apple-darwin12.2.0
checking target system type... x86_64-apple-darwin12.2.0
checking whether the C compiler works... no
configure: error: in `/usr/local/rvm/src/ruby-1.9.3-p194':
configure: error: C compiler cannot create executables
See `config.log' for more details
unknown7cd1c3e98b07:~ pdenlinger$ cat config.log
cat: config.log: No such file or directory
unknown7cd1c3e98b07:~ pdenlinger$

GCC 消息:

gcc --version

i686-apple-darwin11-llvm-gcc-4.2 (GCC) 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.11.00)
Copyright (C) 2007 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

“酿造医生”消息

brew doctor
Warning: Unbrewed .pc files were found in /usr/local/lib/pkgconfig.
If you didn't put them there on purpose they could cause problems when
building Homebrew formulae, and may need to be deleted.

Unexpected .pc files:
    /usr/local/lib/pkgconfig/fuse.pc
Warning: You have a non-Homebrew 'pkg-config' in your PATH:
  /opt/sm/pkg/active/bin/pkg-config

`./configure` may have problems finding brew-installed packages using
this other pkg-config.

在 Homebrew 之外配置脚本:

sudo mkdir /usr/local/Cellar
Password:
unknown7cd1c3e98b07:local pdenlinger$ sudo chown -R `whoami` /usr/local
unknown7cd1c3e98b07:local pdenlinger$ man chown
unknown7cd1c3e98b07:local pdenlinger$ brew doctor
Warning: "config" scripts exist outside your system or Homebrew directories.
`./configure` scripts often look for *-config scripts to determine if
software packages are installed, and what additional flags to use when
compiling and linking.

Having additional scripts in your path can confuse software installed via
Homebrew if the config script overrides a system or Homebrew provided
script of the same name. We found the following "config" scripts:

    /opt/sm/pkg/active/bin/curl-config
    /opt/sm/pkg/active/bin/ncurses5-config
    /opt/sm/pkg/active/bin/ncursesw5-config
    /opt/sm/pkg/active/bin/pkg-config
    /opt/sm/pkg/active/bin/xml2-config
    /opt/sm/pkg/active/bin/xslt-config
Warning: Unbrewed .pc files were found in /usr/local/lib/pkgconfig.
If you didn't put them there on purpose they could cause problems when
building Homebrew formulae, and may need to be deleted.

Unexpected .pc files:
    /usr/local/lib/pkgconfig/fuse.pc
Warning: You have a non-Homebrew 'pkg-config' in your PATH:
  /opt/sm/pkg/active/bin/pkg-config

`./configure` may have problems finding brew-installed packages using
this other pkg-config.

【问题讨论】:

  • 如果您按照 rvm 的要求“阅读 /usr/local/rvm/log/ruby-1.9.3-p194/configure.log”,是否提供任何有用的信息?
  • 好的,下一条线索:“配置:错误:C 编译器无法创建可执行文件”是 gcc 安装在您的系统上---它与 X 代码捆绑在一起吗?它在工作吗?或者您是否正在使用 Xcode 的替代品,例如:stackoverflow.com/questions/11436674/…
  • 是的,GCC 已安装。消息已添加到上面的正文中。
  • 我能想到的另一件事是您的 gcc 不是 Ruby 正在寻找的 gcc。你也可以运行which gcc 吗?

标签: ruby rvm osx-mountain-lion


【解决方案1】:

好的,因为您的 rvm 使用 CFLAGS 和 PATH 运行:

CFLAGS=-I/opt/sm/pkg/active/include CPATH=/opt/sm/pkg/active/include

您的 gcc 必须来自 Home Brew,而不是 Xcode,这是 no longer necessary

我的建议是按照上面的链接重新安装 gcc,然后尝试重新安装 ruby​​。

这个问题也可能有帮助: RVM ruby installation errors - Mac

【讨论】:

  • 嗯。我之前确实安装了 Homebrew 和 RVM,但今天我刚刚收到 Moncef Belyamani 的关于如何在 Mountain Lion 上安装 Ruby 1.9.3 的说明,所以我想再做一次。今天早上刚下载了苹果的命令行工具。我是否需要彻底卸载 Homebrew 和 RVM,然后重新安装?有什么命令?
  • @pdenlinger 我不知道你是否需要彻底卸载,但我发现这一步通常比它引起的麻烦更多——因为它省去了查找各种配置的麻烦文件并修改它们包含的路径。以下是卸载 Homebrew 的说明:superuser.com/questions/203707/…。 Rvm 更容易卸载。使用rvm imploderm -rf ~/.rvm
  • 刚刚卸载了 Homebrew 和 RVM,并进行了新安装,当我运行“brew doctor”时收到一条消息。上面添加的消息。
  • 看起来 Homebrew 没有完全卸载,但这没关系,因为如果您按照链接安装了 GCC,当您重新安装 rvm 时,它应该寻找并找到您的新 GCC 二进制文件。
  • 刚刚更改了一些附加设置,Homebrew 列出了可能导致问题的附加配置脚本。以上所列。我需要删除它们吗?
猜你喜欢
  • 2012-07-24
  • 2013-04-13
  • 2012-09-18
  • 2013-03-21
  • 2012-07-24
  • 2013-03-18
  • 2012-12-12
  • 2012-12-11
  • 2014-01-31
相关资源
最近更新 更多