在 Mac OS Lion 上安装 Ruby 1.9.2 时出现问题 [英] Problem installing Ruby 1.9.2 on Mac OS Lion

查看:54
本文介绍了在 Mac OS Lion 上安装 Ruby 1.9.2 时出现问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在运行 Lion,使用 Xcode 4,安装了 RVM 和自制软件,但只能运行 ruby​​ 1.8.7

<前>斯普维斯:~ rogue$ ruby​​ -vruby 1.8.7 (2010-01-10 补丁级别 249) [universal-darwin11.0]斯普维斯:~流氓$

我已经阅读了与此主题相关的几个线程,但似乎没有解决我的问题:

<前>spurvis:~ rogue$ rvm install 1.9.2将 Ruby 从源安装到:/Users/rogue/.rvm/rubies/ruby-1.9.2-p290,这可能需要一段时间,具体取决于您的 CPU...ruby-1.9.2-p290 - #fetchingruby-1.9.2-p290 - #extracted 到/Users/rogue/.rvm/src/ruby-1.9.2-p290 (已经提取)将 yaml-0.1.4.tar.gz 提取到/Users/rogue/.rvm/archives将 yaml-0.1.4.tar.gz 解压到/Users/rogue/.rvm/src在/Users/rogue/.rvm/src/yaml-0.1.4 中配置 yaml.在/Users/rogue/.rvm/src/yaml-0.1.4 中编译 yaml.将 yaml 安装到/Users/rogue/.rvm/usrruby-1.9.2-p290 - #configuringruby-1.9.2-p290 - #compiling错误:运行'make'时出错,请阅读/Users/rogue/.rvm/log/ruby-1.9.2-p290/make.log错误:运行 make 时出现错误.停止安装.

make.log 为我提供以下信息:

<前>[2011-08-08 11:50:52]/usr/bin/gcc-4.2 -O3 -ggdb -Wextra -Wno-unused-parameter -Wno-parentheses -Wpointer-arith -Wwrite-strings -Wno-missing-field-initialrbconfig.rb 不变./miniruby -I./lib -I.ext/common -I./- -r./ext/purelib.rb ./enc/make_encmake.rb --builtin-encs="ascii.o us_ascii.o unicode.utf_8../miniruby -I./lib -I.ext/common -I./- -r./ext/purelib.rb -I../tool/compile_prelude.rb ./prelude.rb ./enc/prelude.rb ./gem_prelude/usr/bin/gcc-4.2 -O3 -ggdb -Wextra -Wno-unused-parameter -Wno-parentheses -Wpointer-arith -Wwrite-strings -Wno-missing-field-initialar rcu libruby.1.9.1-static.a dln.o encoding.o version.o array.o bignum.o class.o compar.o complex.o dir.o dln_find.o enum.o enumera/usr/bin/gcc-4.2 -dynamiclib -Wl,-undefined,dynamic_lookup -Wl,-multiply_defined,suppress -Wl,-flat_namespace -install_name/Users/r: -w -L 'Init_*' -L '*_threadptr_*' libruby.1.9.1.dylib./miniruby -I./lib -I.ext/common -I./- -r./ext/purelib.rb ./tool/generic_erb.rb -c -o encdb.h ./template/encdb.h.tmpl ./encencdb.h 不变make -f enc.mk RUBY="./miniruby -I./lib -I.ext/common -I./- -r./ext/purelib.rb " MINIRUBY="./miniruby -I./lib -I.ext/common -I./- -rmake[1]: 对 `enc' 不需要做任何事情.make -f enc.mk RUBY="./miniruby -I./lib -I.ext/common -I./- -r./ext/purelib.rb " MINIRUBY="./miniruby -I./lib -I.ext/common -I./- -rmake[1]: 对 `srcs' 不做任何处理../miniruby -I./lib -I.ext/common -I./- -r./ext/purelib.rb ./tool/generic_erb.rb -c -o transdb.h ./template/transdb.h.tmpl ./enc/tratransdb.h 不变make -f enc.mk RUBY="./miniruby -I./lib -I.ext/common -I./- -r./ext/purelib.rb " MINIRUBY="./miniruby -I./lib -I.ext/common -I./- -rmake[1]:对`./enc/trans' 没有任何处理.make -f enc.mk RUBY="./miniruby -I./lib -I.ext/common -I./- -r./ext/purelib.rb " MINIRUBY="./miniruby -I./lib -I.ext/common -I./- -rmkdir -p .ext/x86_64-darwin11.0.0/enc .ext/x86_64-darwin11.0.0/enc/trans enc/trans编译-test-/bug-3662make[1]:对所有人"无事可做.编译 -test-/stringmake[1]:对所有人"无事可做.编译 bigdecimalmake[1]:对所有人"无事可做.编译继续make[1]:对所有人"无事可做.编译覆盖make[1]:对所有人"无事可做.编译诅咒编译openssl/usr/bin/gcc-4.2 -I.-I../../.ext/include/x86_64-darwin11.0.0 -I../.././include -I../.././ext/openssl -DRUBY_EXTCONF_H=\"extconf.h\"ossl_bio.c:在函数‘ossl_obj2bio’中:ossl_bio.c:26: 错误:被调用的对象.rnd"不是函数ossl_bio.c:42: 警告:隐式转换将 64 位值缩短为 32 位值make[1]: *** [ossl_bio.o] 错误 1制作:*** [mkmain.sh] 错误 1

根据其他建议,我尝试将 export CC=/usr/bin/gcc-4.2 添加到我的 bashrc 中,但这也没有解决问题.

请帮忙!

解决方案

确保您有最新的 xcode 可用(如果您正在运行雪豹的副本,则需要更新它.更新 RVM rvmget head 然后再试一次.

我在编译 ree 时遇到问题,但 1.9.2 运行良好,您可以尝试将此函数添加到主目录中的 .profile,它将使用 gcc(而不是默认的 LLVM)进行编译

# using_gcc for 64btt 在Lion 上编译(解决兼容性问题)函数 using_gcc() {环境 CC="/usr/bin/gcc-4.2" ARCHFLAGS="-arch x86_64" ARCHS="x86_64" $*}

然后运行using_gcc rvm install 1.9.2

I am running Lion, utilizing Xcode 4, have RVM and homebrew installed but am only able to run ruby 1.8.7

    spurvis:~ rogue$ ruby -v
    ruby 1.8.7 (2010-01-10 patchlevel 249) [universal-darwin11.0]
    spurvis:~ rogue$ 

I've read through several threads related to this topic but nothing seems to work for my problem:

    spurvis:~ rogue$ rvm install 1.9.2
    Installing Ruby from source to: /Users/rogue/.rvm/rubies/ruby-1.9.2-p290, this may take a     while depending on your cpu(s)...

    ruby-1.9.2-p290 - #fetching 
    ruby-1.9.2-p290 - #extracted to /Users/rogue/.rvm/src/ruby-1.9.2-p290 (already extracted)
    Fetching yaml-0.1.4.tar.gz to /Users/rogue/.rvm/archives
    Extracting yaml-0.1.4.tar.gz to /Users/rogue/.rvm/src
    Configuring yaml in /Users/rogue/.rvm/src/yaml-0.1.4.
    Compiling yaml in /Users/rogue/.rvm/src/yaml-0.1.4.
    Installing yaml to /Users/rogue/.rvm/usr
    ruby-1.9.2-p290 - #configuring 
    ruby-1.9.2-p290 - #compiling 
    ERROR: Error running 'make ', please read /Users/rogue/.rvm/log/ruby-1.9.2-p290/make.log
    ERROR: There has been an error while running make. Halting the installation.

The make.log gives me the following info:

    [2011-08-08 11:50:52] make
    /usr/bin/gcc-4.2 -O3 -ggdb -Wextra -Wno-unused-parameter -Wno-parentheses -Wpointer-arith  -Wwrite-strings -Wno-missing-field-initial
    rbconfig.rb unchanged
    ./miniruby -I./lib -I.ext/common -I./- -r./ext/purelib.rb  ./enc/make_encmake.rb --  builtin-encs="ascii.o us_ascii.o unicode.o utf_8.
    ./miniruby -I./lib -I.ext/common -I./- -r./ext/purelib.rb  -I. ./tool/compile_prelude.rb     ./prelude.rb ./enc/prelude.rb ./gem_prelude
    /usr/bin/gcc-4.2 -O3 -ggdb -Wextra -Wno-unused-parameter -Wno-parentheses -Wpointer-arith -Wwrite-strings -Wno-missing-field-initial
    ar rcu libruby.1.9.1-static.a dln.o encoding.o version.o array.o bignum.o class.o compar.o     complex.o dir.o dln_find.o enum.o enumera
    /usr/bin/gcc-4.2 -dynamiclib -Wl,-undefined,dynamic_lookup -Wl,-multiply_defined,suppress -Wl,-flat_namespace -install_name /Users/r
    : -w -L 'Init_*' -L '*_threadptr_*' libruby.1.9.1.dylib
    ./miniruby -I./lib -I.ext/common -I./- -r./ext/purelib.rb  ./tool/generic_erb.rb -c -o    encdb.h ./template/encdb.h.tmpl ./enc enc
    encdb.h unchanged
    make -f enc.mk RUBY="./miniruby -I./lib -I.ext/common -I./- -r./ext/purelib.rb "    MINIRUBY="./miniruby -I./lib -I.ext/common -I./- -r
    make[1]: Nothing to be done for `enc'.
    make -f enc.mk RUBY="./miniruby -I./lib -I.ext/common -I./- -r./ext/purelib.rb "  MINIRUBY="./miniruby -I./lib -I.ext/common -I./- -r
    make[1]: Nothing to be done for `srcs'.
./miniruby -I./lib -I.ext/common -I./- -r./ext/purelib.rb  ./tool/generic_erb.rb -c -o  transdb.h ./template/transdb.h.tmpl ./enc/tra
    transdb.h unchanged
    make -f enc.mk RUBY="./miniruby -I./lib -I.ext/common -I./- -r./ext/purelib.rb "    MINIRUBY="./miniruby -I./lib -I.ext/common -I./- -r
    make[1]: Nothing to be done for `./enc/trans'.
make -f enc.mk RUBY="./miniruby -I./lib -I.ext/common -I./- -r./ext/purelib.rb "   MINIRUBY="./miniruby -I./lib -I.ext/common -I./- -r
    mkdir -p .ext/x86_64-darwin11.0.0/enc .ext/x86_64-darwin11.0.0/enc/trans enc enc/trans
    compiling -test-/bug-3662
    make[1]: Nothing to be done for `all'.
    compiling -test-/string
    make[1]: Nothing to be done for `all'.
    compiling bigdecimal
    make[1]: Nothing to be done for `all'.
    compiling continuation
    make[1]: Nothing to be done for `all'.
    compiling coverage
    make[1]: Nothing to be done for `all'.
    compiling curses
    
    compiling openssl
    /usr/bin/gcc-4.2 -I. -I../../.ext/include/x86_64-darwin11.0.0 -I../.././include - I../.././ext/openssl -DRUBY_EXTCONF_H=\"extconf.h\"
    ossl_bio.c: In function ‘ossl_obj2bio’:
    ossl_bio.c:26: error: called object ‘".rnd"’ is not a function
    ossl_bio.c:42: warning: implicit conversion shortens 64-bit value into a 32-bit value
    make[1]: *** [ossl_bio.o] Error 1
    make: *** [mkmain.sh] Error 1

Per other suggestions I tried adding export CC=/usr/bin/gcc-4.2 to my bashrc but that didn't solve the problem either.

Please help!

解决方案

Make sure you have the latest xcode available (you'll need to update it if you're running a copy from snow leopard. Update RVM rvm get head and then try again.

I had problems compiling ree but 1.9.2 worked fine, you can try adding this function to .profile in your home directory, it'll compile with gcc (instead of the default LLVM)

# using_gcc for 64btt compiling on lion (solves compatability issues)
function using_gcc() {
  env CC="/usr/bin/gcc-4.2" ARCHFLAGS="-arch x86_64" ARCHS="x86_64" $*
}

Then run using_gcc rvm install 1.9.2

这篇关于在 Mac OS Lion 上安装 Ruby 1.9.2 时出现问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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