Having Issues with Curb gem on Mac Snow Leopard

☆樱花仙子☆ 提交于 2019-12-22 10:57:13

问题


This has consumed hours of my time.

in the console i run: require 'curb'

i get the error:

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

I have tried uninstalling the gem and reinstalling a number of versions with ARCHFLAGS="-arch i386" No errors or warnings are given in the install When i try and install with: rake install I get this error as well.

I am working on a mac ox 10.6 with ruby 1.8

i notice there are libcurl.4.dylib, libcurl.3.dylib, and libcurl.2.dlib and libcurl.dylib in my /usr/lib folder...

I did an install of the newest 7.20 curl package.

I have tried to install from the source as well and get this error

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...]

Suggestions?


回答1:


just try :

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

Worked for me.




回答2:


I had a very similar issue that also consumed hours of my time. I'm running into more problems later when trying to use a proxy but to get around that error I had to download the libcurl source from sourceforge and build it.

I believe Snow Leopard dropped PPC support and this library may not be x86 native. Recompiling fixes this issue (possibly), so give it a try.




回答3:


This issue occurred for me when switching from rvm to 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

Note this bit: Library not loaded: /Users/lfender/.rvm/rubies/ruby-1.9.3-p484/lib/libruby.1.9.1.dylib. Because I switch my ruby versioning system from rvm, I needed to rebuild the gem with the correct packages.



来源:https://stackoverflow.com/questions/2350141/having-issues-with-curb-gem-on-mac-snow-leopard

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!