在mavericks上安装任何带有RVM的ruby版本

时间:2021-11-22 07:25:15

I've just upgraded to osx mavericks, and I want to install ruby 2.0, but I'm getting configure: error: cannot run C compiled programs. errors.

我刚刚升级到osx mavericks,我想要安装ruby 2.0,但是我得到了configure: error:无法运行C编译的程序。错误。

I update rvm with rvm get stable and then type rvm install 2.0.0 and get an error directing me to a log file. The log file contains:

我使用rvm更新rvm,得到稳定,然后输入rvm安装2.0.0,并得到一个指向日志文件的错误。日志文件包含:

configure: WARNING: unrecognized options: --without-tcl, --without-tk
checking build system type... x86_64-apple-darwin13.0.0
checking host system type... x86_64-apple-darwin13.0.0
checking target system type... x86_64-apple-darwin13.0.0
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/mattroberts/.rvm/src/ruby-2.0.0-p247':
configure: error: cannot run C compiled programs.
If you meant to cross compile, use `--host'.
See `config.log' for more details

So, I tried listing the versions I do have. It tells me i have 1.9.3-p392 so I uninstall that one and re-install to see if that works - same error.

所以,我试着列出我有的版本。它告诉我有1。9.3-p392,所以我卸载了那个,然后重新安装,看看它是否有效——同样的错误。

Do I need to re-install / update xcode, or is there another solution?

我需要重新安装/更新xcode,还是有其他解决方案?

Thanks!

谢谢!

7 个解决方案

#1


53  

If you haven't upgraded Xcode after upgrading to Mavericks you should do so After that, open a command prompt and type:
xcode-select --install

如果您在升级到Mavericks之后还没有升级Xcode,那么您应该这样做,打开一个命令提示符和类型:Xcode -select—install。

This will install xcode command tools that have been deleted by OSX update. After that it should work okay.

这将安装被OSX更新删除的xcode命令工具。在那之后它应该可以工作。

#2


28  

The suggested solutions did not solve my issue (XCode at newest version, command line tools installed). I used rvm install ruby-1.9.3 --with-gcc=clang and that worked.

建议的解决方案没有解决我的问题(最新版本的XCode,安装了命令行工具)。我使用了rvm安装ruby-1.9.3——with-gcc=clang,这很有效。

I thought rvm used to use clang for OSX by default. Not sure if I remember that wrong or something changed / this is no longer the best thing to do. Nevertheless it made the install work for me.

我原以为rvm默认使用clang来处理OSX。我不确定我是否记得错了或发生了什么改变/这不再是最好的选择。然而,它使安装工作为我。

After Edu's comment, the github rvm issues page he referenced warns:

在Edu的评论之后,他引用的github rvm发布页面警告说:

@marksands please be sure you know what you are duing, ruby 1.9.3 compiled with clang is not "safe", it can segfault, thread related issues to be expected, consider reinstalling ruby --with-gcc=gcc42 or just let rvm install gcc 4.6, only ruby 2.0.0 is fully compatible with clang

@marksands请确保您知道您正在进行的是什么,使用clang编译的ruby 1.9.3并不是“安全”的,它可以分段故障,线程相关的问题预计会出现,考虑重新安装ruby -with-gcc=gcc42,或者让rvm安装gcc 4.6,只有ruby 2.0.0与clang完全兼容

This issue points out issue with gcc46 on Mavericks:

这个问题指出了gcc46关于小牛的问题:

The gem in question uses different language - not C/C++, it uses Objective-C - so it's not the compiler fault, you can build gcc-4.6 with support for Objective-C - it's just not done by default.

这个gem使用了不同的语言——不是C/ c++,而是Objective-C——所以这不是编译器的问题,您可以使用Objective-C来构建gcc-4.6——这不是默认的。

You have two options now, both start with uninstallig gcc-4.6 and then:

你现在有两个选择,都从uninstallig gcc-4.6开始,然后:

• Install apple-gcc42

•安装apple-gcc42

• Install gcc-4.6 with --enable-objc

•安装gcc-4.6与-enable-objc。

#3


8  

this is supposed to be fixed, run:

这应该是固定的,运行:

rvm get head
rvm remove 1.9.3
rvm install 1.9.3

do not use extra flags

不要使用额外的标志?

#4


3  

What ended up working for me was installing XCode then RUNNING Xcode then trying to reinstall.

最终对我有用的是安装XCode然后运行XCode然后尝试重新安装。

#5


1  

Running

运行

rvm_configure_env=('LDFLAGS=-L/opt/sm/pkg/active/lib' 'CFLAGS=-I/opt/sm/pkg/active/include' 'CPATH=/opt/sm/pkg/active/include')

Corrected my compiler issue in Mavericks

修正了我在Mavericks中的编译问题

#6


0  

Ran into the very same issue (on 10.8.5, all up to date). Ruby 2.0.0 installed fine, but not 1.9.3. This solution worked for me.

遇到了同样的问题(10.8.5是最新的)。Ruby 2.0.0安装得很好,但不是1.9.3。这个办法对我起作用了。

cd into the ruby path (found in config.log), then issue .configure (with all options, as found in config.log)

将cd放入ruby路径(在config.log中找到),然后发出.configure(带有所有选项,如在config.log中所示)

make
make install

Then:

然后:

rvm use 1.9.3 --create

#7


0  

Solution:

unset SDKROOT

设置SDKROOT

This worked for me. I hope it would for you too.

这为我工作。我希望对你也一样。

I tried to reinstall xcode along with xcode developer tools. Didn’t work. The same error.

我试图与xcode开发工具一起重新安装xcode。没有工作。同样的错误。

Try to run with env -i bash —noprofile —norc to see whether your env vars are causing the issue to further investigate.

尝试使用env -i bash -noprofile -norc运行,看看您的env vars是否导致问题进一步调查。

#1


53  

If you haven't upgraded Xcode after upgrading to Mavericks you should do so After that, open a command prompt and type:
xcode-select --install

如果您在升级到Mavericks之后还没有升级Xcode,那么您应该这样做,打开一个命令提示符和类型:Xcode -select—install。

This will install xcode command tools that have been deleted by OSX update. After that it should work okay.

这将安装被OSX更新删除的xcode命令工具。在那之后它应该可以工作。

#2


28  

The suggested solutions did not solve my issue (XCode at newest version, command line tools installed). I used rvm install ruby-1.9.3 --with-gcc=clang and that worked.

建议的解决方案没有解决我的问题(最新版本的XCode,安装了命令行工具)。我使用了rvm安装ruby-1.9.3——with-gcc=clang,这很有效。

I thought rvm used to use clang for OSX by default. Not sure if I remember that wrong or something changed / this is no longer the best thing to do. Nevertheless it made the install work for me.

我原以为rvm默认使用clang来处理OSX。我不确定我是否记得错了或发生了什么改变/这不再是最好的选择。然而,它使安装工作为我。

After Edu's comment, the github rvm issues page he referenced warns:

在Edu的评论之后,他引用的github rvm发布页面警告说:

@marksands please be sure you know what you are duing, ruby 1.9.3 compiled with clang is not "safe", it can segfault, thread related issues to be expected, consider reinstalling ruby --with-gcc=gcc42 or just let rvm install gcc 4.6, only ruby 2.0.0 is fully compatible with clang

@marksands请确保您知道您正在进行的是什么,使用clang编译的ruby 1.9.3并不是“安全”的,它可以分段故障,线程相关的问题预计会出现,考虑重新安装ruby -with-gcc=gcc42,或者让rvm安装gcc 4.6,只有ruby 2.0.0与clang完全兼容

This issue points out issue with gcc46 on Mavericks:

这个问题指出了gcc46关于小牛的问题:

The gem in question uses different language - not C/C++, it uses Objective-C - so it's not the compiler fault, you can build gcc-4.6 with support for Objective-C - it's just not done by default.

这个gem使用了不同的语言——不是C/ c++,而是Objective-C——所以这不是编译器的问题,您可以使用Objective-C来构建gcc-4.6——这不是默认的。

You have two options now, both start with uninstallig gcc-4.6 and then:

你现在有两个选择,都从uninstallig gcc-4.6开始,然后:

• Install apple-gcc42

•安装apple-gcc42

• Install gcc-4.6 with --enable-objc

•安装gcc-4.6与-enable-objc。

#3


8  

this is supposed to be fixed, run:

这应该是固定的,运行:

rvm get head
rvm remove 1.9.3
rvm install 1.9.3

do not use extra flags

不要使用额外的标志?

#4


3  

What ended up working for me was installing XCode then RUNNING Xcode then trying to reinstall.

最终对我有用的是安装XCode然后运行XCode然后尝试重新安装。

#5


1  

Running

运行

rvm_configure_env=('LDFLAGS=-L/opt/sm/pkg/active/lib' 'CFLAGS=-I/opt/sm/pkg/active/include' 'CPATH=/opt/sm/pkg/active/include')

Corrected my compiler issue in Mavericks

修正了我在Mavericks中的编译问题

#6


0  

Ran into the very same issue (on 10.8.5, all up to date). Ruby 2.0.0 installed fine, but not 1.9.3. This solution worked for me.

遇到了同样的问题(10.8.5是最新的)。Ruby 2.0.0安装得很好,但不是1.9.3。这个办法对我起作用了。

cd into the ruby path (found in config.log), then issue .configure (with all options, as found in config.log)

将cd放入ruby路径(在config.log中找到),然后发出.configure(带有所有选项,如在config.log中所示)

make
make install

Then:

然后:

rvm use 1.9.3 --create

#7


0  

Solution:

unset SDKROOT

设置SDKROOT

This worked for me. I hope it would for you too.

这为我工作。我希望对你也一样。

I tried to reinstall xcode along with xcode developer tools. Didn’t work. The same error.

我试图与xcode开发工具一起重新安装xcode。没有工作。同样的错误。

Try to run with env -i bash —noprofile —norc to see whether your env vars are causing the issue to further investigate.

尝试使用env -i bash -noprofile -norc运行,看看您的env vars是否导致问题进一步调查。