使用 Xcode 4.3.1 在 Mac 上更新 Ruby 的问题 [英] Issue updating Ruby on Mac with Xcode 4.3.1

查看:41
本文介绍了使用 Xcode 4.3.1 在 Mac 上更新 Ruby 的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 RVM 安装它,但它给了我这个错误:

I'm using RVM to install it and it gives me this error:

The provided compiler '/usr/bin/gcc' is LLVM based, it is not yet fully supported by ruby and gems, please read `rvm requirements`.

我使用的是 Lion 10.7.3,我使用的是 Xcode 4.3.1.

I'm on Lion 10.7.3 and I have Xcode 4.3.1.

推荐答案

简而言之,您可以获取 RVM 主分支(不稳定)以使用 LLVM(不是 gcc,我最初输入错误)构建它.默认情况下,它有适当的补丁使 1.9.3-p125 与 Xcode 4.3.1 一起运行(至少更好).我提供了补丁.如果您已经安装了 RVM,rvm get head 将安装主分支.使用 Xcode 4.3.1 安装的命令行工具,您可以成功安装 Ruby 1.9.3-p125.

Short answer is you can grab RVM master branch (not stable) to build it with LLVM (not gcc, I mistyped initially). It has appropriate patches to make 1.9.3-p125 to run (at least better) with Xcode 4.3.1 by default. I provided the patch. If you already installed RVM, rvm get head will install the master branch. With command line tools installed with Xcode 4.3.1, you can successfully install Ruby 1.9.3-p125.

背景

这是由于 Ruby 1.9.3-p125 的一个简单配置问题导致的,它不允许动态链接模块工作.如果您使用的是 Xcode 4.3.x(Ruby Issue#6080),则会发生这种情况.

It's happen due to a simple configuration issue of Ruby 1.9.3-p125, it don't allow dynamic link modules to work. This happens if you're using Xcode 4.3.x (Ruby Issue#6080).

此问题已在 更改集 r34840 中修复.

RVM 有补丁系统,提供每个版本的基础.此补丁包含在 RV​​M(现在是 master 分支)中,现在默认用于 p125 配置步骤.

RVM has patch system which provides per-version basis. This patch is included in the RVM (master branch for now) and now default for p125 configuration steps.

Xcode 4.3.x 命令行工具

首先,使用 Xcode 4.3.x,您需要在安装 Xcode 4.3.x 后安装命令行工具,按照以下说明:1) 启动 Xcode,2) 从菜单栏上的Xcode"项中打开Preferences".3) 选择下载"选项卡(图标).4)单击命令行工具"的安装"按钮(从我朋友的网站借用的说明这里)

First, With Xcode 4.3.x, you need to install command line tool AFTER installing Xcode 4.3.x, by following directions: 1) Launching Xcode, 2) Open "Preferences" from the "Xcode" item on the menu bar. 3) Select "Downloads" tab (icon). 4) Click "Install" button for "Command Line Tools" (directions borrowed from my friend's site here)

如果 Xcode 4.3.1 安装正确,则 cc --version 应该发出:

If Xcode 4.3.1 is correctly installed, then cc --version should emit:

% cc --version
Apple clang version 3.1 (tags/Apple/clang-318.0.54) (based on LLVM 3.1svn)
Target: x86_64-apple-darwin11.3.0
Thread model: posix

autoconf 和 automake

您需要 autoconf 和 automake,因为 Xcode 4.3.x 没有它们.安装它们 brewMacPorts. 使用 MacPorts:

You need autoconf and automake, since Xcode 4.3.x don't have them. Install them either brew or MacPorts. With MacPorts:

sudo port install autoconf automake

推荐的 RVM 安装步骤

然后,要安装 RVM 的特定分支,您可以:

Then, To install specific branch of RVM, you can:

REPO=wayneeseguin
BRANCH=master # stable for the stable branch
curl -s https://raw.github.com/${REPO}/rvm/${BRANCH}/binscripts/rvm-installer > /tmp/rvm-installer.sh
bash /tmp/rvm-installer.sh --branch ${REPO}/${BRANCH}

或者如果 RVM 已经安装:

Or if RVM is already installed:

rvm get head   # master branch, for stable branch "rvm get stable"

之后,使用 rvm pkg 命令安装 openssl、iconv 和 readline 以获得最佳效果.我最近在关注.其中一部分可能需要包含在 RV​​M 中..

After that, install openssl, iconv and readline using rvm pkg command for best result. I do following lately. Part of this might need to be included to RVM..

rvm pkg install openssl
rvm pkg install readline # if you prefer GNU readline

然后,最后,安装 Ruby.

Then, finally, install the Ruby.

rvm install 1.9.3-p125 --patch xcode-debugopt-fix-r34840.diff --with-readline-dir=$rvm_path/usr --with-openssl-dir=$rvm_path/usr --with-tcl-lib=/usr --with-tk-lib=/usr

rvm pkg 的帮助推荐了不同的参数,帮助坏了.所以现在使用上面的.如果您通过 MacPorts(像我一样)获得 tcl/tk 参数,则需要它们

rvm pkg's help recommend different parameter, the help is broken. So use above for now. You need tcl/tk parameters if you have them via MacPorts(like me)

顺便说一句,可以安装旧的 Xcode,然后使用 export CC="gcc-4.2" rvm install 1.9.3-p125 运行 rvm,但我个人认为 clang (LLVM) 是如果可能的话,未来的道路.

By the way, It is possible to install old Xcode then run rvm with export CC="gcc-4.2" rvm install 1.9.3-p125, but I personally think clang (LLVM) is the way to go for future, if possible.

希望这会有所帮助.

关于 2012/3/31 的附加说明

iconv 不需要安装,还添加了 autoconf/automake 要求以进行说明.

iconv don't need to install, also added autoconf/automake requirements for clarifications.

关于 2012/4/13 的附加说明

最新稳定版不包括默认情况下需要动态链接才能工作的补丁.构建1.9.3-p125时需要添加--patch xcode-debugopt-fix-r34840.diff.

Latest stable does not include the patch require dynamic link to work by default. you need to add --patch xcode-debugopt-fix-r34840.diff when you build 1.9.3-p125.

这篇关于使用 Xcode 4.3.1 在 Mac 上更新 Ruby 的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆