gpt4 book ai didi

ruby - 如何在运行 10.6 的 Macbook Pro i7 上修复此 RVM 错误

转载 作者:太空宇宙 更新时间:2023-11-03 16:57:55 26 4
gpt4 key购买 nike

我收到此页面描述的错误 http://www.fakingfantastic.com/2010/11/26/fixing-the-you-have-to-install-development-tools-first-error-with-nokogiri/按照他们的指示,我收到了以下错误:

[2011-02-13 11:05:03]  ./configure --prefix=/Users/MYNAME/.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... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... configure: error: in `/Users/MYNAME/.rvm/src/ruby-1.9.2-p136':
configure: error: cannot run C compiled programs.
If you meant to cross compile, use `--host'.
See `config.log' for more details

我认为这是:https://gist.github.com/767866看起来像一个 aswer,但我找不到 .rvmrc。

编辑:我认为问题是 i386。我的 1.8.2 安装似乎是 x8x_64。

编辑 2:经过更多工作后,我发现了这个错误

[2011-02-13 11:51:05]  ./configure --prefix=/Users/MYNAME/.rvm/rubies/ruby-1.9.2-p136 --enable-shared            --build=i386-apple-darwin10.6.0           --host=i386-apple-darwin10.6.0 
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 i386-apple-darwin10.6.0-gcc... no
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking for i386-apple-darwin10.6.0-g++... no
checking for i386-apple-darwin10.6.0-c++... no
checking for i386-apple-darwin10.6.0-gpp... no
checking for i386-apple-darwin10.6.0-aCC... no
checking for i386-apple-darwin10.6.0-CC... no
checking for i386-apple-darwin10.6.0-cxx... no
checking for i386-apple-darwin10.6.0-cc++... no
checking for i386-apple-darwin10.6.0-cl.exe... no
checking for i386-apple-darwin10.6.0-FCC... no
checking for i386-apple-darwin10.6.0-KCC... no
checking for i386-apple-darwin10.6.0-RCC... no
checking for i386-apple-darwin10.6.0-xlC_r... no
checking for i386-apple-darwin10.6.0-xlC... no
checking for g++... g++
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking how to run the C preprocessor... /lib/cpp
configure: error: in `/Users/MYNAME/.rvm/src/ruby-1.9.2-p136':
configure: error: C preprocessor "/lib/cpp" fails sanity check
See `config.log' for more details
[2011-02-13 11:58:36] ./configure --prefix=/Users/MYNAME/.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... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... configure: error: in `/Users/MYNAME/.rvm/src/ruby-1.9.2-p136':
configure: error: cannot run C compiled programs.
If you meant to cross compile, use `--host'.
See `config.log' for more details

最佳答案

@eggie5 说:

I would put in your os x cd and install xcode again.

不要从 DVD 安装 XCode。 10.6 (Snow Leopard) 磁盘上的版本已知存在错误。从 Apple's XCode 安装最新版本地点。您必须注册才能下载,但这是免费注册。

我怀疑你升级到 10.6,而不是你买机器时默认安装的。 10.6 是 64 位的,它的相关 XCode 版本也是,所以一切都应该是 64 位的。因为它闻起来不像普通的 Leopard 或 10.6 之前的操作系统。这意味着所有 RVM 托管的 Rubies 都是可疑的,需要清理,以及在升级和更新 XCode 之前编译的任何 gem。

安装 XCode 发行版后,您需要先卸载,然后再安装 RVM 托管的 Rubies。首先,将 RVM 更新到最新版本:键入 rvm -v 并记下版本号。输入 rvm get head 加载最新版本。加载完成后,您应该会看到一个新的修订号。 RVM 变化很快,因此您需要定期更新到最新版本。

这是来自 RVM FAQ这是使用 RVM 的非常好的信息,尤其是关于将 sudo 与 gems 一起使用的评论:

My ruby is compiling as 32 bit but I am on Mac OS X Snow Leopard which has heavy advertisement that it is 64 bit!!!

RVM compiles to your current running kernel's architecture. This means that if your kernel is running as a 32 bit kernel (uname -m) it will compile 32 bit. You can override this behavior by placing the following in your ~/.rvmrc before installing the ruby interpreter:

rvm_archflags="-arch x86_64"

我认为设置它而不是依赖默认值是个好主意,因为从现在开始您可能会使用 64 位。

键入 rvm reload 或关闭终端窗口并重新打开 session 。

键入rvm notes 并阅读。这会根据您的操作系统为您提供顺利安装 Ruby 所需的先决条件列表。未能安装这些意味着各种功能可能无法在 Ruby 中运行,这将导致随机的、奇怪的失败。

键入 rvm list 并记下您安装的 Ruby 版本。假设您的第一个是 ruby-1.8.7-p330。类型:

rvm uninstall ruby-1.8.7-p330
rvm install ruby-1.8.7-p330

对您已安装的每一个重复此操作。完成后键入 rvm info 并查看它所说的内容是否通过了健全性检查。

如果一切正常,就该为您的 gem 重建 native 驱动程序了。

这两个步骤都是可选的,但它们是良好的定期内务管理的一部分:

  • 如果您有一段时间没有运行gem update,您可能想要更新您的gems。 rvm ruby​​ 'gem update' 将遍历已安装的 Rubies,更新它们。
  • 人们积累旧 gem 但通常不清理它们,因此,为了加快重建您的 gem ,您可能应该清理旧 gem 。您必须注意它在处理过程中告诉您的内容,因为它会让您了解无法满足的依赖关系。 rvm ruby​​ 'gem clean' 将遍历已安装的 Rubies,并清除旧的东西。

要重建 native 驱动程序,请键入 rvm ruby​​ 'gem pristine --all',这将重新安装您的所有 gem。

然后,运行 rvm info 并确保它再次返回正常的信息。

此外,作为紧急逃生口,通过键入 rm -f ~/.rvm 或使用rvm implode,然后重新开始。重新安装 Ruby 是整个过程中最长的部分,一旦支持库就绪,RVM 就可以让它变得非常轻松。

关于ruby - 如何在运行 10.6 的 Macbook Pro i7 上修复此 RVM 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4985246/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com