2012-07-26 167 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