我在 MacOS Lion(内核 v11.4.0)上使用 RVM v1.10.2、ruby v1.9.3p0 和 ruby gems v1.8.15。
我使用 sinatra 为基于机架的项目创建了一个 gemset,并安装了一堆 gem,包括 eventmachine(由于安装了 thin)。没问题。
几周后,我为一个类似的项目创建了一个新的 gemset,但是当我尝试安装 Thin 时,一切都失败了。看起来编译 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
我安装其他 gem 没有问题,所以我怀疑这是编译器问题,但这里是 的输出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)
任何帮助深表感谢!