安装Ruby on Mountain Lion的问题 – ruby​​ 1.9.3 wont’compile

前端之家收集整理的这篇文章主要介绍了安装Ruby on Mountain Lion的问题 – ruby​​ 1.9.3 wont’compile前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我以前看过一些帖子,并按照他们的指示,但没有任何工作.我将在下面概述我所做的一切,并遵循以下指示 – 感谢任何建议!

我已经遵循以下安装说明:
http://pragmaticstudio.com/blog/2010/9/23/install-rails-ruby-mac

我已经为OSX Mountain Lion下载了X代码,并安装了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.

然后我按照指示完成并安装了最新版本的git

$git --version
git version 1.7.10.2 (Apple Git-33)

并且通过命令行类似地使用rvm:

$rvm --version
rvm 1.16.13 (stable) by Wayne E. Seguin <wayneeseguin@gmail.com>,Michal Papis <mpapis@gmail.com> [https://rvm.io/]

当我尝试使用RVM安装ruby时,我得到以下内容

$rvm install 1.9.3
No binary rubies available for: osx/10.8/x86_64/ruby-1.9.3-p286.
Continuing with compilation. Please read 'rvm mount' to get more information on binary rubies.
Installing Ruby from source to: /Users/mondemoo/.rvm/rubies/ruby-1.9.3-p286,this may take a while depending on your cpu(s)...
ruby-1.9.3-p286 - #downloading ruby-1.9.3-p286,this may take a while depending on your connection...
ruby-1.9.3-p286 - #extracted to /Users/mondemoo/.rvm/src/ruby-1.9.3-p286 (already extracted)
ruby-1.9.3-p286 - #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/Users/mondemoo/.rvm/usr/lib ./configure --enable-shared --disable-install-doc --prefix=/Users/mondemoo/.rvm/rubies/ruby-1.9.3-p286',please read /Users/mondemoo/.rvm/log/ruby-1.9.3-p286/configure.log
There has been an error while running configure. Halting the installation.

使用替代命令行,我得到一个类似的输出,但有一些额外的位:

$rvm install 1.9.3 --with-gcc=clang
-bash: -dumpversion: command not found
-bash: --version: command not found
-bash: --version: command not found
Installing Ruby from source to: /Users/mondemoo/.rvm/rubies/ruby-1.9.3-p286,this may take a while depending on your connection...
ruby-1.9.3-p286 - #extracted to /Users/mondemoo/.rvm/src/ruby-1.9.3-p286 (already extracted)
ruby-1.9.3-p286 - #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/Users/mondemoo/.rvm/usr/lib ./configure --enable-shared --disable-install-doc --prefix=/Users/mondemoo/.rvm/rubies/ruby-1.9.3-p286 --with-gcc=clang',please read /Users/mondemoo/.rvm/log/ruby-1.9.3-p286/configure.log
There has been an error while running configure. Halting the installation.
-bash: --version: command not found

查看configure.logs,我得到以下内容

$less /Users/mondemoo/.rvm/log/ruby-1.9.3-p286/configure.log
[2012-10-17 07:39:15] env LDFLAGS=-L/opt/sm/pkg/active/lib CFLAGS=-I/opt/sm/pkg/active/include CPATH=/opt/sm/pkg/active/include -L/Users/mondemoo/.rvm/usr/lib ./configure --enable-shared --disable-install-doc --prefix=/Users/mondemoo/.rvm/rubies/ruby-1.9.3-p286 --with-gcc=clang
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 `/Users/mondemoo/.rvm/src/ruby-1.9.3-p286':
configure: error: C compiler cannot create executables
See `config.log' for more details

我现在完全混淆了我做错了什么 – 有人能帮助吗?看来,c编译器(gcc?)有一个问题,我正在解释它吗?如果是这样我怎么解决?另外我该如何获得上面的configure.log中提到的这个“config.log”?

谢谢!

解决方法

这是RailsInstaller OSX 1.0.3 – https://github.com/railsinstaller/railsinstaller-nix/issues/10中的一个错误

您需要更改/ etc / rvmrc以包含以下内容

umask g+w
export -a rvm_configure_env
rvm_configure_env=('LDFLAGS=-L/opt/sm/pkg/active/lib' 'CFLAGS=-I/opt/sm/pkg/active/include' 'CPATH=/opt/sm/pkg/active/include')

当二进制ruby可用于2.0.0时,我将准备新版本的安装程序.

更新:对于新版本的RVM 1.19 / etc / rvmrc应该更改为:

umask g+w
export rvm_autolibs_flag=smf

并运行rvm获取stabel #OR:头

原文链接:https://www.f2er.com/ruby/271022.html

猜你在找的Ruby相关文章