需要帮助在Mac OSX 10.7上安装Ruby 1.9.2

时间:2011-08-21 03:57:37

标签: ruby macos rvm osx-lion

我一直在努力解决这个问题大约10个小时。我真的希望这里有人可以提供帮助。我可能已经在本网站和其他许多网站上查看了所有可能的解决方案。

我正在关注ruby.railstutorial.org教程。我现在是安装ruby 1.8.7和1.9.2的部分。当我运行rvm install 1.9.2时,我得到:

下面是我的make.log中的错误。如果还有其他问题,请告诉我。

Installing Ruby from source to: /Users/user/.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/user/.rvm/src/ruby-1.9.2-p290 (already extracted)
Fetching yaml-0.1.4.tar.gz to /Users/user/.rvm/archives
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  460k  100  460k    0     0   394k      0  0:00:01  0:00:01 --:--:--  601k
Extracting yaml-0.1.4.tar.gz to /Users/user/.rvm/src
Configuring yaml in /Users/user/.rvm/src/yaml-0.1.4.
Compiling yaml in /Users/user/.rvm/src/yaml-0.1.4.
Installing yaml to /Users/user/.rvm/usr
ruby-1.9.2-p290 - #configuring 
ruby-1.9.2-p290 - #compiling 
ERROR: Error running 'make ', please read /Users/user/.rvm/log/ruby-1.9.2-p290/make.log
ERROR: There has been an error while running make. Halting the installation.

这是make.log

中的内容
/usr/bin/gcc-4.2 -O3 -ggdb -Wextra -Wno-unused-parameter -Wno-parentheses -Wpointer-arith -Wwrite-strings -Wno-missing-field-initializers -Wshorten-64-to-32 -Wno-long-long  -fno-common -pipe -L.  -Wl,-u,_objc_msgSend   main.o dmydln.o dmyencoding.o dmyversion.o miniprelude.o array.o bignum.o class.o compar.o complex.o dir.o dln_find.o enum.o enumerator.o error.o eval.o load.o proc.o file.o gc.o hash.o inits.o io.o marshal.o math.o node.o numeric.o object.o pack.o parse.o process.o random.o range.o rational.o re.o regcomp.o regenc.o regerror.o regexec.o regparse.o regsyntax.o ruby.o safe.o signal.o sprintf.o st.o strftime.o string.o struct.o time.o transcode.o util.o variable.o compile.o debug.o iseq.o vm.o vm_dump.o thread.o cont.o ascii.o us_ascii.o unicode.o utf_8.o newline.o  dmyext.o -lpthread -ldl -lobjc  -o miniruby
ld: warning: ignoring file dmyext.o, file was built for i386 which is not the architecture being linked (x86_64)
Undefined symbols for architecture x86_64:
  "_Init_ext", referenced from:
      _require_libraries in ruby.o
ld: symbol(s) not found for architecture x86_64
collect2: ld returned 1 exit status
make: *** [miniruby] Error 1

这是我的.bash_profile

env CC="/usr/bin/gcc-4.2" ARCHFLAGS="-arch x86_64" ARCHS="x86_64" $*
export CC=/usr/bin/gcc-4.2
[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # Load RVM function
[[ -s "/Users/user/.rvm/scripts/rvm" ]] && source "/Users/user/.rvm/scripts/rvm"  # This loads RVM into a shell session.

2 个答案:

答案 0 :(得分:3)

由于从您的日志文件中看起来dmyext.o不是最后一个构建过程的一部分,因此它可能是早期(失败)构建的剩余部分。为了确保你开始清洁:

  1. rm -rf ~/.rvm
  2. 重新安装rvm
  3. env ARCHFLAGS="-arch x86_64" rvm install 1.9.2
  4. 修改

    如詹姆斯所指出的那样,还要将其添加到.rvmrc

    export rvm_archflags="-arch x86_64"
    

答案 1 :(得分:1)

尝试:

env ARCHFLAGS="-arch x86_64" rvm install 1.9.2