簡體   English   中英

在Mac OS Lion上安裝Ruby 1.9.2的問題

[英]Problem installing Ruby 1.9.2 on Mac OS Lion

我正在運行Lion,利用Xcode 4,安裝了RVM和自制程序,但我只能運行ruby 1.8.7

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

我已經閱讀了與此主題相關的幾個主題,但似乎沒有任何問題可以解決我的問題:

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.

make.log給了我以下信息:

[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

根據其他建議,我嘗試將導出CC = / usr / bin / gcc-4.2添加到我的bashrc,但這也沒有解決問題。

請幫忙!

確保你有最新的xcode(如果你正在運行雪豹的副本,你需要更新它。更新RVM rvm get head ,然后再試一次。

我在編譯ree時遇到問題,但1.9.2工作正常,你可以嘗試在你的主目錄中將此函數添加到.profile,它將使用gcc編譯(而不是默認的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" $*
}

然后運行using_gcc rvm install 1.9.2

如果你正在運行Lion&Xcode 4.2的全新副本,那么你首先需要安裝GCC 4.2 dev庫 - 它們不包含在新的Xcode 4.2安裝中。

然后在安裝rvm時傳遞CC="/usr/bin/gcc-4.2"標志。

請務必rvm remove任何先前的安裝嘗試。

如果你想用ruby 1.8.7獲得rvm install ree來工作,這解決了我的問題:

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

#then

using_gcc rvm install ree

基本上只是在另一個答案中將“64”改為“32”。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM