gpt4 book ai didi

ruby - 如何继续 gem 安装过程

转载 作者:数据小太阳 更新时间:2023-10-29 08:13:18 26 4
gpt4 key购买 nike

我正在尝试安装需要编译 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 时,我的 makefile 被覆盖了。

那么我怎样才能在不丢失对 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!

最佳答案

您安装了最新的 XCode 了吗?

  1. 安装 XCode 4.4
  2. 从 XCode 4.4 首选项对话框安装命令行工具

关于ruby - 如何继续 gem 安装过程,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10156958/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com