0

MacOS Lion(kernel v11.4.0)でRVM v1.10.2、ruby v1.9.3p0、rubygemsv1.8.15を使用しています。

sinatraを使用してラックベースのプロジェクト用のgemsetを作成し、eventmachineを含む多数のgemをインストールしました(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

次に、さまざまなファイルをコンパイルしようとすると、何百万もの警告が発行されます。最後に、この興味深いビットがあります。

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)

どんな助けでも大歓迎です!

4

2 に答える 2

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

単なる警告ではなかったのは、出力内の唯一のものです。見落としたなんて信じられません。それがclangが報告する原因error: linker command failedです。私はこれに遭遇した後に気づきました:RVM MacOSXでRuby1.9.2をインストールする際のトラブル

/usr/local/lib/libz.1.dylibはへの単なるシンボリックリンク/usr/local/lib/libz.1.2.5.dylibであり、ファイルの日付によると、最初にeventmachineをインストールした後のある時点で作成されました。だから、削除/usr/local/lib/libz.1.dylibしたばかりで、eventmachineを正常にインストールできました。LLVM gccに戻しても、それでも機能しました。

于 2012-07-28T11:50:10.780 に答える
1

clang / LLVMを使用してrubyをビルドしています-これは実験的にのみサポートされています。LLVMベースではないgcc-4.2を使用する必要があります。これは、rvm要件でかなり適切に説明されています。

rvm get head     # get the latest update with the new requirements
rvm requirements # read carefully and follow instructions!
于 2012-07-26T20:43:39.160 に答える