2012-04-14 81 views
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中。现在运行良好,图书馆似乎编译。

现在是什么?当我再次运行gem install phashion时,我的makefile被覆盖。

那么,如何在不损失对gem的更改的情况下再次启动安装过程?

PS:我试图改变成宝石的目录,并运行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! 
+0

我能够安装在我的Mac这一优良无需任何额外的库。我的建议是:'gem uninstall phasion'然后'gem install phasion' ...你是否收到构建本机扩展的消息。这可能需要一段时间...? – hagope 2012-04-14 20:27:16

+0

是的,删除了宝石,并重新安装,但没有运气。我用我得到的错误更新了我的问题,并添加了我的操作系统版本(Lion 10.7.3)。你是否必须安装libjpeg,并使用MacPorts(或Brew)? – Wukerplank 2012-04-15 05:31:18

回答

0

您是否安装了最新的XCode?在Xcode

  1. 安装了XCode 4.4
  2. 安装的命令行工具4.4 Preferences对话框
+0

是的,一切都在原地。 – Wukerplank 2013-01-04 08:56:17