在Mac OS X Snow Leopard上使用RVM安装Ruby 1.9.2的问题

时间:2011-08-26 15:57:26

标签: ruby osx-snow-leopard rvm

我刚刚开始学习Ruby,并试图在Macbook Air上使用RVM安装最新版本并且它一直在失败。我必须做错事,因为在网上进行了大量搜索之后,我没有看到有人在Ruby安装过程中抱怨这个确切的错误。

采取的步骤:

Dima$ rvm install ruby-1.9.2-p290
Installing Ruby from source to: /Users/Dima/.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/Dima/.rvm/src/ruby-1.9.2-p290 (already extracted)
Fetching yaml-0.1.4.tar.gz to /Users/Dima/.rvm/archives
Extracting yaml-0.1.4.tar.gz to /Users/Dima/.rvm/src
Configuring yaml in /Users/Dima/.rvm/src/yaml-0.1.4.
Compiling yaml in /Users/Dima/.rvm/src/yaml-0.1.4.
Installing yaml to /Users/Dima/.rvm/usr
ruby-1.9.2-p290 - #configuring 
ruby-1.9.2-p290 - #compiling 
ERROR: Error running 'make ', please read /Users/Dima/.rvm/log/ruby-1.9.2-p290/make.log
ERROR: There has been an error while running make. Halting the installation.

在此之后,正如建议的错误消息,我去了make.log文件:

compiling fiddle
/usr/bin/gcc-4.2 -I. -I../../.ext/include/x86_64-darwin10.7.0 -I../.././include -I../.././ext/fiddle -DRUBY_EXTCONF_H=\"extconf.h\" -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  -fno-common -pipe  -o closure.o -c closure.c
In file included from closure.c:1:
./fiddle.h:18:17: error: ffi.h: No such file or directory
In file included from ./fiddle.h:71,
                 from closure.c:1:
./conversions.h:24: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
closure.c:7: error: expected specifier-qualifier-list before ‘ffi_closure’
closure.c: In function ‘dealloc’:
closure.c:22: error: ‘fiddle_closure’ has no member named ‘pcl’
closure.c:26: error: ‘fiddle_closure’ has no member named ‘cif’
closure.c:27: error: ‘fiddle_closure’ has no member named ‘argv’
closure.c:27: error: ‘fiddle_closure’ has no member named ‘argv’
closure.c: In function ‘closure_memsize’:
closure.c:40: error: ‘fiddle_closure’ has no member named ‘cif’
closure.c:42: error: ‘fiddle_closure’ has no member named ‘argv’
closure.c:43: error: ‘ffi_closure’ undeclared (first use in this function)
closure.c:43: error: (Each undeclared identifier is reported only once
closure.c:43: error: for each function it appears in.)
closure.c: At top level:
closure.c:54: error: expected ‘)’ before ‘*’ token
closure.c: In function ‘allocate’:
closure.c:146: error: ‘fiddle_closure’ has no member named ‘pcl’
closure.c:146: error: ‘ffi_closure’ undeclared (first use in this function)
closure.c:151: error: ‘fiddle_closure’ has no member named ‘cif’
closure.c:151: error: ‘ffi_cif’ undeclared (first use in this function)
closure.c: In function ‘initialize’:
closure.c:163: error: ‘ffi_cif’ undeclared (first use in this function)
closure.c:163: error: ‘cif’ undeclared (first use in this function)
closure.c:164: error: ‘ffi_closure’ undeclared (first use in this function)
closure.c:164: error: ‘pcl’ undeclared (first use in this function)
closure.c:165: error: ‘ffi_status’ undeclared (first use in this function)
closure.c:165: error: expected ‘;’ before ‘result’
closure.c:169: error: ‘FFI_DEFAULT_ABI’ undeclared (first use in this function)
closure.c:177: error: ‘fiddle_closure’ has no member named ‘argv’
closure.c:177: error: ‘ffi_type’ undeclared (first use in this function)
closure.c:177: error: expected expression before ‘)’ token
closure.c:181: error: ‘fiddle_closure’ has no member named ‘argv’
closure.c:183: error: ‘fiddle_closure’ has no member named ‘argv’
closure.c:188: error: ‘fiddle_closure’ has no member named ‘cif’
closure.c:189: error: ‘fiddle_closure’ has no member named ‘pcl’
closure.c:191: error: ‘result’ undeclared (first use in this function)
closure.c:193: error: ‘fiddle_closure’ has no member named ‘argv’
closure.c:195: error: ‘FFI_OK’ undeclared (first use in this function)
closure.c:199: error: ‘callback’ undeclared (first use in this function)
make[1]: *** [closure.o] Error 1
make: *** [mkmain.sh] Error 1

我不确定如何解读这个,我最初的本能就是说我没有安装FFI,但我从来没有在Ruby的任何安装步骤中看到这个要求。这是我的电脑特有的东西吗?

非常感谢有经验的人提供的任何帮助。对于帖子中任何缺失的部分提前道歉,因为我不完全确定如何解决这个问题。请告诉我哪些其他信息有助于解决问题,我会将其添加到帖子中。

由于

3 个答案:

答案 0 :(得分:2)

Thoughtbot提供了一个很好的指南,可以在新的OSX安装上设置rails。绝对检查它,因为它可能会帮助你:

http://robots.thoughtbot.com/post/8700977975/2011-rubyists-guide-to-a-mac-os-x-development

答案 1 :(得分:1)

当我开始在我的macbook pro上进行一些rails编程时,在使用rvm安装ruby时遇到了一些错误。不记得我得到的错误,但我必须安装xcode然后我可以用rvm安装ruby。

答案 2 :(得分:0)

经过数小时的挫折后,我最终在我的Macbook Air上加载了Mac OS X Lion和Xcode 4,然后又尝试再次运行rvm install ruby-1.9.2-p290并且没有问题。