本文介绍了在Mountain Lion上安装Ruby的问题 - ruby​​ 1.9.3不会'编译的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我之前看过很多帖子,都按照他们的说明进行操作,但没有任何结果。我会在下面概述我所做的事情,以及我所遵循的指示 - 会很感激任何建议!



我遵循以下安装说明:



我已经为OSX Mountain Lion下载了X代码,并安装了gcc编译器:

  $ gcc --version 
i686-apple-darwin11-llvm-gcc-4.2(GCC)4.2.1(基于Apple Inc 。build 5658)(LLVM build 2336.11.00)
Copyright(C)2007 Free Software Foundation,Inc.
这是免费软件;请参阅复制条件的来源。没有任何b $ b保修;甚至不适用于适销性或针对特定用途的适用性。

然后按照指示安装最新版本的git

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

类似地通过命令行对rvm完成相同的操作:

  $ rvm --version 
rvm 1.16.13(稳定版)作者Wayne E. Seguin ,Michal Papis< [email protected]>当我尝试使用RVM安装ruby时,我会尝试使用RVM来安装ruby,而不是使用RVM来安装ruby。[/ b] [b] [/ b] [/ b]获取以下内容:

  $ rvm install 1.9.3 
无二进制红宝石可用于:osx / 10.8 / x86_64 /红宝石1.9.3-P286。
继续编译。请阅读'rvm mount'以获取关于二进制红宝石的更多信息。
将Ruby从源代码安装到:/Users/mondemoo/.rvm/rubies/ruby-1.9.3-p286,这可能需要一段时间,具体取决于您的cpu(s)...
ruby​​-1.9 .3-p286 - #下载ruby-1.9.3-p286,这可能需要一段时间,具体取决于您的连接...
ruby​​-1.9.3-p286 - #extracted to /Users/mondemoo/.rvm/ src / ruby​​-1.9.3-p286(已解压缩)
ruby​​-1.9.3-p286 - #configuring
运行'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',请阅读/Users/mondemoo/.rvm/log/ruby-1.9.3-p286/configure.log
运行configure时出错。停止安装。

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

  $ rvm install 1.9.3 --with-gcc = clang 
-bash:-dumpversion:找不到命令
-bash:--version:找不到命令
-bash:--version:找不到命令
从源代码安装Ruby到:/Users/mondemoo/.rvm/rubies/ruby-1.9.3- p286,这可能需要一段时间取决于你的cpu(s)...
ruby​​-1.9.3-p286 - #下载ruby-1.9.3-p286,这可能需要一段时间,这取决于你的连接。 。
ruby​​-1.9.3-p286 - #提取到/Users/mondemoo/.rvm/src/ruby-1.9.3-p286(已提取)
ruby​​-1.9.3-p286 - #配置
运行'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',请阅读/Users/mondemoo/.rv m / log / ruby​​-1.9.3-p286 / configure.log
运行configure时出错。停止安装。
-bash:--version:command not found

纵观configure.log,我收到以下内容:

  $ 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
检查编译系统类型... x86_64-apple-darwin12.2.0
检查主机系统类型... x86_64-apple-darwin12。 2.0
检查目标系统类型... x86_64-apple-darwin12.2.0
检查C编译器是否工作... no
configure:error:in`/Users/mondemoo/.rvm /src/ruby-1.9.3-p286':
configure:error:C编译器无法创建可执行文件
查看`config.log'以获取更多详细信息

我现在完全搞不清楚我做错了什么 - 任何人都可以协助?看来c编译器(gcc?)存在问题,我是否正确解释它?如果是的话我该如何解决这个问题?另外,如何获得上面configure.log中提到的这个config.log?



谢谢!

解决方案

这是RailsInstaller OSX 1.0.3中的一个错误 -



您需要更改 / 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 get stabel #OR :头


I have seen a number of posts on this before and have followed their instructions but nothing is working. I'll outline below what I have done, and the instructions I have follows - would be grateful for any advice!

I have followed the following installation instructions:http://pragmaticstudio.com/blog/2010/9/23/install-rails-ruby-mac

I have downloaded X-code for OSX Mountain Lion, and installed the gcc compiler:

$ 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.

I have then done as instructed and installed the latest version of git

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

and similarly done the same with rvm via command line:

$ rvm --version
rvm 1.16.13 (stable) by Wayne E. Seguin <[email protected]>, Michal Papis <[email protected]> [https://rvm.io/]

When I then try to install ruby using RVM, I get the following:

$ 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.

Using the alternate command line I get a similar output though the with some extra bits:

$ 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

Looking into the configure.logs, I get the following:

$ 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

I'm now utterly confused as to what I have done wrong - is anyone able to assist?? It appears that there is an issue with the c-compiler (gcc?), am I interpreting it correctly? If so how do I fix that? Also how do I get to this "config.log" that is mentioned in the configure.log above?

Thanks!

解决方案

This is a bug in RailsInstaller OSX 1.0.3 - https://github.com/railsinstaller/railsinstaller-nix/issues/10

you need to change /etc/rvmrc to contain this:

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

I will prepare new version of the installer when binary ruby is available for 2.0.0.

UPDATE: for new version of RVM 1.19+ /etc/rvmrc should be changed to:

umask g+w
export rvm_autolibs_flag=smf

And run rvm get stabel #OR: head

这篇关于在Mountain Lion上安装Ruby的问题 - ruby​​ 1.9.3不会'编译的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-26 11:49