在Mac Snow Leopard上遇到Curb gem的问题

这耗费了我几个小时的时间。

在控制台中我运行:require’curb’

我收到错误:

LoadError: dlopen(/usr/local/lib/ruby/gems/1.8/gems/taf2-curb-0.5.4.0/lib/curb_core.bundle, 9): no suitable image found. Did find: /usr/local/lib/ruby/gems/1.8/gems/taf2-curb-0.5.4.0/lib/curb_core.bundle: mach-o, but wrong architecture - /usr/local/lib/ruby/gems/1.8/gems/taf2-curb-0.5.4.0/lib/curb_core.bundle from /usr/local/lib/ruby/gems/1.8/gems/taf2-curb-0.5.4.0/lib/curb_core.bundle from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require' from /Users/user/Sites/CSG/vendor/rails/activesupport/lib/active_support/dependencies.rb:156:in `require' from /Users/user/Sites/CSG/vendor/rails/activesupport/lib/active_support/dependencies.rb:521:in `new_constants_in' from /Users/user/Sites/CSG/vendor/rails/activesupport/lib/active_support/dependencies.rb:156:in `require' from /usr/local/lib/ruby/gems/1.8/gems/taf2-curb-0.5.4.0/lib/curb.rb:1 from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `gem_original_require' from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `require' from /Users/user/Sites/CSG/vendor/rails/activesupport/lib/active_support/dependencies.rb:156:in `require' from /Users/user/Sites/CSG/vendor/rails/activesupport/lib/active_support/dependencies.rb:521:in `new_constants_in' from /Users/user/Sites/CSG/vendor/rails/activesupport/lib/active_support/dependencies.rb:156:in `require' from ./lib/tokbox/base_api.rb:7 

我已经尝试卸载gem并使用ARCHFLAGS =“ – arch i386”重新安装了许多版本。安装时没有给出错误或警告当我尝试安装时:rake install我也得到了这个错误。

我正在使用ruby 1.8制作mac ox 10.6

我注意到我的/ usr / lib文件夹中有libcurl.4.dylib,libcurl.3.dylib和libcurl.2.dlib以及libcurl.dylib …

我安装了最新的7.20curl包。

我也尝试从源代码安装并得到此错误

 localhost:taf2-curb-ac0b465 user$ rake install (in /Users/user/Downloads/taf2-curb-ac0b465) /Users/user/Downloads/taf2-curb-ac0b465/ext/curb_core.bundle: dlopen(/Users/user/Downloads/taf2-curb-ac0b465/ext/curb_core.bundle, 9): no suitable image found. Did find: (LoadError) /Users/user/Downloads/taf2-curb-ac0b465/ext/curb_core.bundle: mach-o, but wrong architecture - /Users/user/Downloads/taf2-curb-ac0b465/ext/curb_core.bundle from /Users/user/Downloads/taf2-curb-ac0b465/lib/curb.rb:1 from /Users/user/Downloads/taf2-curb-ac0b465/tests/helper.rb:12:in `require' from /Users/user/Downloads/taf2-curb-ac0b465/tests/helper.rb:12 from ./tests/tc_curl_download.rb:1:in `require' from ./tests/tc_curl_download.rb:1 from /usr/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake/rake_test_loader.rb:5:in `load' from /usr/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake/rake_test_loader.rb:5 from /usr/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake/rake_test_loader.rb:5:in `each' from /usr/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake/rake_test_loader.rb:5 rake aborted! Command failed with status (1): [/usr/local/bin/ruby -I"lib" "/usr/local/li...] 

建议?

试一试 :

 sudo env ARCHFLAGS="-arch x86_64" gem install curb 

为我工作。

我有一个非常类似的问题,也浪费了我几个小时的时间。 我在以后尝试使用代理时遇到了更多问题,但为了解决这个错误我必须从sourceforge下载libcurl源并构建它。

我相信Snow Leopard掉了PPC支持,这个库可能不是x86原生的。 重新编译修复了这个问题(可能),所以试一试。

从rvm切换到chruby时,我遇到了这个问题。

 /Users/lfender/source/rentals/vendor/ruby/1.9.1/gems/curb-0.7.15/lib/curb.rb:1:in `require': dlopen(/Users/lfender/source/rentals/vendor/ruby/1.9.1/gems/curb-0.7.15/lib/curb_core.bundle, 9) Library not loaded: /Users/lfender/.rvm/rubies/ruby-1.9.3-p484/lib/libruby.1.9.1.dylib (LoadError) Reason: image not found - /Users/lfender/source/rentals/vendor/ruby/1.9.1/gems/curb-0.7.15/lib/curb_core.bundle 

请注意这一点: Library not loaded: /Users/lfender/.rvm/rubies/ruby-1.9.3-p484/lib/libruby.1.9.1.dylib 。 因为我从rvm切换我的ruby版本控制系统,我需要用正确的包重建gem。