Ruby 在 OSX Lion 上使用 rbenv 失败 [英] Ruby fails on OSX Lion with rbenv

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

问题描述

我一直在尝试在我的 Lion 机器 (OSX 10.7.3) 上安装 Ruby.

我安装了 rbenv 和 ruby​​-build 并试图在我的机器上安装 1.9.2-p290.这是安装失败的输出:

$ rbenv install 1.9.2-p290正在下载 http://pyyaml.org/download/libyaml/yaml-0.1.4.tar.gz...正在安装 yaml-0.1.4...将 yaml-0.1.4 安装到/Users/CSC/.rbenv/versions/1.9.2-p290正在下载 http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.2-p290.tar.gz...安装 ruby​​-1.9.2-p290...构建失败检查或清理/var/folders/vm/gcqcld015jx025m7qgtxvw0m0000gn/T/ruby-build.20120301140751.6239 中的工作树结果记录到/var/folders/vm/gcqcld015jx025m7qgtxvw0m0000gn/T/ruby-build.20120301140751.6239.log最后 10 行日志:/usr/bin/gcc-4.2 -I.-I../../../.ext/include/x86_64-darwin11.3.0 -I../../.././include -I../../.././ext/racc/cparse -DRUBY_EXTCONF_H=\"extconf.h\" -I'/Users/SamCouch/.rbenv/versions/1.9.2-p290/include' -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -fno-common -O3 -ggdb -Wextra -Wno-unused-parameter -Wno-parentheses -Wpointer-arith -Wwrite-strings -Wno-missing-field-initializers -Wshorten-64-to-32 -Wno-long-long -pipe -o cparse.o -c cparse.c/usr/bin/gcc-4.2 -dynamic -bundle -o ../../../.ext/x86_64-darwin11.3.0/racc/cparse.bundle cparse.o -L.-二.-L'/Users/SamCouch/.rbenv/versions/1.9.2-p290/lib' -L/usr/local/lib -Wl,-undefined,dynamic_lookup -Wl,-multiply_defined,suppress -Wl,-flat_namespace -lpthread-ldl -lobjc编译阅读线/usr/bin/gcc-4.2 -I.-I../../.ext/include/x86_64-darwin11.3.0 -I../.././include -I../.././ext/readline -DRUBY_EXTCONF_H=\"extconf.h\" -I'/Users/SamCouch/.rbenv/versions/1.9.2-p290/include' -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -fno-common -O3 -ggdb -Wextra -Wno-unused-parameter -Wno-parentheses -Wpointer-算术 -Wwrite-strings -Wno-missing-field-initializers -Wshorten-64-to-32 -Wno-long-long -pipe -o readline.o -c readline.creadline.c:在函数username_completion_proc_call"中:readline.c:1386: 错误:'username_completion_function' 未声明(第一次在这个函数中使用)readline.c:1386: 错误: (每个未声明的标识符只报告一次readline.c:1386: 错误:对于它出现的每个函数.)make[1]: *** [readline.o] 错误 1制作:*** [mkmain.sh] 错误 1

我试图解决这个问题,但到目前为止我还没有想出任何解决方案:

$ which gcc/usr/bin/gcc$ gcci686-apple-darwin11-llvm-gcc-4.2:没有输入文件$ ruby​​-build红宝石构建 20120216用法:ruby-build [-v|--verbose] 定义前缀ruby-build --definitions

任何帮助将不胜感激!

顺便说一下,我已经尝试过这里发布的其他类似建议,但没有一个对我有用.

解决方案

每个 ruby​​-build issue #130 当前的解决方法是:

<代码>env CC=/usr/bin/gcc rbenv 安装 1.9.3-p125

我刚刚在一个系统上成功地测试了这个:

  • OS X 10.7.3
  • Xcode 4.3.1
  • 已安装 Xcode 的命令行工具(通过 Xcode > 首选项 > 下载)
  • ruby-build @ fbfa944
  • rbenv @ 975b45d

此外,待处理的拉取请求 #137 旨在一劳永逸地修复上游.>

FWIW,自从 Xcode 4.3.x 发布以来,很多人都在解决构建链问题.如果您已升级到新工具链,则任何系统都会出现一些不稳定现象,直到集体尘埃落定.

I've been trying to install Ruby on my Lion machine (OSX 10.7.3).

I installed rbenv and ruby-build and am trying to get 1.9.2-p290 on my machine. Here is the output of the install failing:

$ rbenv install 1.9.2-p290
Downloading http://pyyaml.org/download/libyaml/yaml-0.1.4.tar.gz...
Installing yaml-0.1.4...
Installed yaml-0.1.4 to /Users/CSC/.rbenv/versions/1.9.2-p290
Downloading http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.2-p290.tar.gz...
Installing ruby-1.9.2-p290...

BUILD FAILED

Inspect or clean up the working tree at /var/folders/vm/gcqcld015jx025m7qgtxvw0m0000gn/T/ruby-build.20120301140751.6239
Results logged to /var/folders/vm/gcqcld015jx025m7qgtxvw0m0000gn/T/ruby-build.20120301140751.6239.log

Last 10 log lines:
/usr/bin/gcc-4.2 -I. -I../../../.ext/include/x86_64-darwin11.3.0 -I../../.././include -I../../.././ext/racc/cparse -DRUBY_EXTCONF_H=\"extconf.h\" -I'/Users/SamCouch/.rbenv/versions/1.9.2-p290/include'  -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE   -fno-common -O3 -ggdb -Wextra -Wno-unused-parameter -Wno-parentheses -Wpointer-arith -Wwrite-strings -Wno-missing-field-initializers -Wshorten-64-to-32 -Wno-long-long  -pipe  -o cparse.o -c cparse.c
/usr/bin/gcc-4.2 -dynamic -bundle -o ../../../.ext/x86_64-darwin11.3.0/racc/cparse.bundle cparse.o -L. -L../../.. -L. -L'/Users/SamCouch/.rbenv/versions/1.9.2-p290/lib'  -L/usr/local/lib -Wl,-undefined,dynamic_lookup -Wl,-multiply_defined,suppress -Wl,-flat_namespace  -lpthread -ldl -lobjc 
compiling readline
/usr/bin/gcc-4.2 -I. -I../../.ext/include/x86_64-darwin11.3.0 -I../.././include -I../.././ext/readline -DRUBY_EXTCONF_H=\"extconf.h\" -I'/Users/SamCouch/.rbenv/versions/1.9.2-p290/include'  -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE   -fno-common -O3 -ggdb -Wextra -Wno-unused-parameter -Wno-parentheses -Wpointer-arith -Wwrite-strings -Wno-missing-field-initializers -Wshorten-64-to-32 -Wno-long-long  -pipe  -o readline.o -c readline.c
readline.c: In function ‘username_completion_proc_call’:
readline.c:1386: error: ‘username_completion_function’ undeclared (first use in this function)
readline.c:1386: error: (Each undeclared identifier is reported only once
readline.c:1386: error: for each function it appears in.)
make[1]: *** [readline.o] Error 1
make: *** [mkmain.sh] Error 1

I attempted to troubleshoot the issue, but so far I haven't come up with any solution:

$ which gcc
/usr/bin/gcc
$ gcc
i686-apple-darwin11-llvm-gcc-4.2: no input files
$ ruby-build
ruby-build 20120216
usage: ruby-build [-v|--verbose] definition prefix
       ruby-build --definitions

Any help would be greatly appreciated!

As a side note, I've tried other similar suggestions posted here, and none have worked for me.

解决方案

Per ruby-build issue #130 the current workaround is:

env CC=/usr/bin/gcc rbenv install 1.9.3-p125

I've just tested this successfully on a system with:

  • OS X 10.7.3
  • Xcode 4.3.1
  • Command Line Tools for Xcode installed (via Xcode > Preferences > Downloads)
  • ruby-build @ fbfa944
  • rbenv @ 975b45d

Also, pending pull request #137 aims to fix this upstream once and for all.

FWIW, lots of folks are shaking out build chain issues with Xcode 4.3.x since it came out. Expect some instability in any system if you've upgraded to the new toolchain until the collective dust settles.

这篇关于Ruby 在 OSX Lion 上使用 rbenv 失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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