2012-07-26 57 views
0

我使用RVM v1.10.2的,红宝石v1.9.3p0和红宝石宝石v1.8.15在MacOS狮(内核v11.4.0)。不能安装eventmachine红宝石宝石。使用RVM,MacOS的狮子

我创建用于使用一个屈基于机架的项目和宝石安装一堆宝石,包括EventMachine的(如薄安装的结果)。没问题。

几个星期后,我创建了一个类似的项目一个新的宝石,但它是所有故障琐珥,当我试图安装薄。看起来像编译eventmachine有问题。我试着创建一个新的gemset并且自己安装eventmachine。没有运气。我不知道它为什么有效,但现在失败了。


每当我gem install eventmachine,它是这样的:

Fetching: eventmachine-0.12.10.gem (100%) 
Building native extensions. This could take a while... 
ERROR: Error installing eventmachine: 
     ERROR: Failed to build gem native extension. 

     /Users/jared/.rvm/rubies/ruby-1.9.3-p0/bin/ruby extconf.rb 
checking for rb_trap_immediate in ruby.h,rubysig.h... no 
checking for rb_thread_blocking_region()... yes 
checking for inotify_init() in sys/inotify.h... no 
checking for __NR_inotify_init in sys/syscall.h... no 
checking for writev() in sys/uio.h... yes 
checking for rb_thread_check_ints()... yes 
checking for rb_time_new()... yes 
checking for sys/event.h... yes 
checking for sys/queue.h... yes 
creating Makefile 

make 

那么它会发出一个bajillion警告,因为它试图编译各种文件,然后,终于,这个有趣的一点:

linking shared-object rubyeventmachine.bundle 
ld: warning: ignoring file /usr/local/lib/libz.dylib, file was built for unsupported file format which is not the architecture being linked (x86_64) 
ld: in /usr/local/lib/libz.1.dylib, file was built for unsupported file format which is not the architecture being linked (x86_64) for architecture x86_64 
clang: error: linker command failed with exit code 1 (use -v to see invocation) 
make: *** [rubyeventmachine.bundle] Error 1 

以下是完整的输出:https://dl.dropbox.com/u/5382910/stackoverflow/gem_make.out


我没有安装其他宝石的问题,所以我怀疑这是一个编译器的问题,但这里的gcc -v输出,万一有人可能会看到的东西:

Using built-in specs. 
Target: i686-apple-darwin11 
Configured with: /private/var/tmp/llvmgcc42/llvmgcc42-2336.1~1/src/configure --disable-checking --enable-werror --prefix=/Developer/usr/llvm-gcc-4.2 --mandir=/share/man --enable-languages=c,objc,c++,obj-c++ --program-prefix=llvm- --program-transform-name=/^[cg][^.-]*$/s/$/-4.2/ --with-slibdir=/usr/lib --build=i686-apple-darwin11 --enable-llvm=/private/var/tmp/llvmgcc42/llvmgcc42-2336.1~1/dst-llvmCore/Developer/usr/local --program-prefix=i686-apple-darwin11- --host=x86_64-apple-darwin11 --target=i686-apple-darwin11 --with-gxx-include-dir=/usr/include/c++/4.2.1 
Thread model: posix 
gcc version 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.1.00) 

任何帮助非常感激!

回答

1

这行是关键:

ld: in /usr/local/lib/libz.1.dylib, file was built for unsupported file format which is not the architecture being linked (x86_64) for architecture x86_64 

这是输出中唯一不只是警告。我不敢相信我忽略了它。这就是铛声报告error: linker command failed的原因。我跑完后意识到这一点:Trouble Installing Ruby 1.9.2 with RVM Mac OS X

/usr/local/lib/libz.1.dylib只是一个符号链接到/usr/local/lib/libz.1.2.5.dylib,根据文件的日期,它是在我第一次安装eventmachine之后的某个时间创建的。所以,我刚刚删除/usr/local/lib/libz.1.dylib,我能够成功安装eventmachine。我甚至还回到了LLVM gcc,它仍然有效。

1

您使用铛/ LLVM建设红宝石 - 这只是实验性的支持,你需要使用gcc-4.2未LLVM基础,这是在RVM要求描述相当不错:

rvm get head  # get the latest update with the new requirements 
rvm requirements # read carefully and follow instructions! 
+0

感谢。我使用Homebrew安装了apple-gcc42,但仍然得到相同的错误。 现在的gcc 4.2.1是版本(苹果公司建立5666)。如何阻止它使用clang? – wyattisimo 2012-07-27 22:13:13

+0

什么是您当前RVM的版本,这是重要的,因为旧版本有不同的处理GCC – mpapis 2012-07-27 23:01:17

+0

我用v1.10.2的,但每次你的建议,我更新了,我现在运行v1.14.7。两个版本都有同样的问题。 – wyattisimo 2012-07-27 23:03:37