3

pHashライブラリをコンパイルする必要があるphashionをインストールしようとしています。pHash は libjpeg に依存します。gem は Linux ボックスには問題なくインストールされますが、私の Mac (Lion 10.7.3) ではいくつか問題があります。

MacPorts 経由で libjpeg をインストールしましたがgem install phashion、プロセスを実行すると失敗し、libjpeg が見つからないというエラーが表示されます。

これは私が得るエラーです:

gcc -I. -I/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin11.0 -I/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin11.0 -I. -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE   -fno-common  -I/Library/Ruby/Gems/1.8/gems/phashion-1.0.4/ext/phashion_ext/include  -L/Library/Ruby/Gems/1.8/gems/phashion-1.0.4/ext/phashion_ext/lib  -x c++   -c phashion_ext.c
cc -arch i386 -arch x86_64 -pipe -bundle -undefined dynamic_lookup -o phashion_ext.bundle phashion_ext.o -L. -L/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib -L/Library/Ruby/Gems/1.8/gems/phashion-1.0.4/ext/phashion_ext/lib -L/Library/Ruby/Gems/1.8/gems/phashion-1.0.4/ext/phashion_ext/lib -L. -arch i386 -arch x86_64     -lruby   -lpthread -lpHash_gem -lstdc++ -ljpeg
ld: library not found for -ljpeg
collect2: ld returned 1 exit status
ld: library not found for -ljpeg
collect2: ld returned 1 exit status
lipo: can't open input file: /var/tmp//ccCwUAM1.out (No such file or directory)
make: *** [phashion_ext.bundle] Error 1


Gem files will remain installed in /Library/Ruby/Gems/1.8/gems/phashion-1.0.4 for inspection.
Results logged to /Library/Ruby/Gems/1.8/gems/phashion-1.0.4/ext/phashion_ext/gem_make.out

libjpeg は にあります/opt/local/lib。そこで、gem の makefile を見て、ライブラリ パスを ldflags に追加しました。これで make が正常に実行され、ライブラリがコンパイルされたように見えます。

今何?もう一度実行gem install phashionすると、メイクファイルが上書きされます。

では、gem への変更を失わずにインストール プロセスを再開するにはどうすればよいでしょうか?

PS: gem のディレクトリに移動して を実行しようとしましたが、次のrakeエラー メッセージで失敗します。

WARNING: rake-compiler found compiled files in 'ext/phashion_ext' directory. Please remove them.
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby -I"lib:lib:test" -I"/Library/Ruby/Gems/1.8/gems/rake-0.9.2.2/lib" "/Library/Ruby/Gems/1.8/gems/rake-0.9.2.2/lib/rake/rake_test_loader.rb" "test/**/test_*.rb" 
/Library/Ruby/Site/1.8/rubygems/custom_require.rb:29:in `gem_original_require': no such file to load -- phashion_ext (LoadError)
    from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:29:in `require'
    from ./lib/phashion.rb:33
    from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:29:in `gem_original_require'
    from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:29:in `require'
    from ./test/helper.rb:3
    from /Library/Ruby/Gems/1.8/gems/phashion-1.0.4/test/test_phashion.rb:1:in `require'
    from /Library/Ruby/Gems/1.8/gems/phashion-1.0.4/test/test_phashion.rb:1
    from /Library/Ruby/Gems/1.8/gems/rake-0.9.2.2/lib/rake/rake_test_loader.rb:10:in `require'
    from /Library/Ruby/Gems/1.8/gems/rake-0.9.2.2/lib/rake/rake_test_loader.rb:10
    from /Library/Ruby/Gems/1.8/gems/rake-0.9.2.2/lib/rake/rake_test_loader.rb:9:in `each'
    from /Library/Ruby/Gems/1.8/gems/rake-0.9.2.2/lib/rake/rake_test_loader.rb:9
    from /Library/Ruby/Gems/1.8/gems/rake-0.9.2.2/lib/rake/rake_test_loader.rb:4:in `select'
    from /Library/Ruby/Gems/1.8/gems/rake-0.9.2.2/lib/rake/rake_test_loader.rb:4
rake aborted!
4

1 に答える 1

0

最新のXCodeをインストールしましたか?

  1. XCode4.4をインストールします
  2. XCode4.4設定ダイアログからコマンドラインツールをインストールする
于 2013-01-04T06:53:28.223 に答える