2012-10-17 52 views
11

我以前见过很多帖子,并且按照他们的说明操作,但没有任何工作。我将在下面概述我所做的事情,以及我所遵循的指示 - 对任何建议都将感激不尽!在山狮上安装Ruby的问题 - 红宝石1.9.3不会'编译

我一直遵守以下安装说明: http://pragmaticstudio.com/blog/2010/9/23/install-rails-ruby-mac

我已经下载X-代码OSX山狮,并安装了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 <[email protected]>, Michal Papis <[email protected]> [https://rvm.io/] 

当我再尝试使用RVM红宝石安装,我得到如下:

$ 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 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 --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”?

谢谢!

+0

请使用四空格缩进来格式化您的文章以获取终端输出。 –

+1

那么配置日志说什么? – halfelf

+0

请阅读/Users/mondemoo/.rvm/log/ruby-1.9.3-p286/configure.log,它很礼貌。 –

回答

22

这是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') 

我将准备安装程序的新版本时,二进制红宝石是供2.0.0。

UPDATE:RVM的新版本1.19+/etc/rvmrc应改为:

umask g+w 
export rvm_autolibs_flag=smf 

和运行rvm get stabel #OR: head

+0

忽略我的最后一篇文章,只是看到这一行继续 - 现在会尝试。 – MrBernz

+0

完美,谢谢! – MrBernz

+0

非常感谢!这对我有用......并且也安装了Ruby 2.0.0。 – markstewie

1

不知道我这样做是 '正确' 的方式,但我只是删除RVM(RVM implode),然后重新安装它(\ curl -L https://get.rvm.io | bash -s stable --ruby)并安装它,现在运行的是最新版本的ruby 1.9.3-p327没有问题。

+0

实际上,我还是得到了这个工作,但是我仍然遇到其他需要本机扩展的问题。 :( – Adron