从MacPorts切换到Homebrew后,libcurl缺少库

时间:2012-08-01 10:18:42

标签: ruby macos libcurl typhoeus

我刚刚删除了Macports所以现在我使用Homebrew。 现在我正在尝试使用typhoeus ruby​​ gem,它依赖于multicurl。

当我尝试执行我的rubyscript时,我收到以下错误消息:

/Users/myusername/.rvm/gems/ruby-1.9.3-p125/gems/ffi-1.0.11/lib/ffi/library.rb:121:in `block in ffi_lib': Could not open library 'libcurl': dlopen(libcurl, 10): image not found. (LoadError) Could not open library 'libcurl.dylib': dlopen(libcurl.dylib, 10): Library not loaded: /opt/local/lib/libidn.11.dylib   Referenced from: /usr/local/lib/libcurl.dylib   Reason: image not found   from /Users/myusername/.rvm/gems/ruby-1.9.3-p125/gems/ffi-1.0.11/lib/ffi/library.rb:88:in `map'     from /Users/myusername/.rvm/gems/ruby-1.9.3-p125/gems/ffi-1.0.11/lib/ffi/library.rb:88:in `ffi_lib'     from /Users/myusername/.rvm/gems/ruby-1.9.3-p125/gems/typhoeus-0.4.2/lib/typhoeus/curl.rb:405:in `<module:Curl>'    from /Users/myusername/.rvm/gems/ruby-1.9.3-p125/gems/typhoeus-0.4.2/lib/typhoeus/curl.rb:6:in `<module:Typhoeus>'  from /Users/myusername/.rvm/gems/ruby-1.9.3-p125/gems/typhoeus-0.4.2/lib/typhoeus/curl.rb:5:in `<top (required)>'   from /Users/myusername/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:55:in `require'  from /Users/myusername/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:55:in `require'  from /Users/myusername/.rvm/gems/ruby-1.9.3-p125/gems/typhoeus-0.4.2/lib/typhoeus.rb:5:in `<top (required)>'    from /Users/myusername/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:60:in `require'  from /Users/myusername/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:60:in `rescue in require'    from /Users/myusername/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:35:in `require'  from app.rb:3:in `<main>'

显然有些文件丢失了。

当我执行$ otool -L /usr/local/bin/curl时,我得到:

/usr/local/lib/libcurl.4.dylib (compatibility version 7.0.0, current version 7.0.0)
/opt/local/lib/libidn.11.dylib (compatibility version 18.0.0, current version 18.5.0)
/opt/local/lib/libintl.8.dylib (compatibility version 10.0.0, current version 10.1.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 159.1.0)
/opt/local/lib/libiconv.2.dylib (compatibility version 8.0.0, current version 8.1.0)
/System/Library/Frameworks/LDAP.framework/Versions/A/LDAP (compatibility version 1.0.0, current version 2.2.0)
/opt/local/lib/libssl.1.0.0.dylib (compatibility version 1.0.0, current version 1.0.0)
/opt/local/lib/libcrypto.1.0.0.dylib (compatibility version 1.0.0, current version 1.0.0)
/opt/local/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.5)

这里的问题是我的文件夹/opt/local/甚至不存在。

  • 如何修复丢失的链接?
  • 我在哪里可以找到丢失的文件? (libidn.11.dylib,libintl.8.dylib,libssl.1.0.0.dylib,libcrypto.1.0.0.dylib和libz.1.dylib)?

其他信息:

  • 我使用的是ruby 1.9.3和Mac OSX 10.8

1 个答案:

答案 0 :(得分:1)

听起来您还没有完全删除MacPorts及其curl

如果您还没有,请按照http://guide.macports.org/chunked/installing.macports.uninstalling.html上的指南进行操作,具体如下:

$ sudo rm -rf \
    /opt/local \
    /Applications/DarwinPorts \
    /Applications/MacPorts \
    /Library/LaunchDaemons/org.macports.* \
    /Library/Receipts/DarwinPorts*.pkg \
    /Library/Receipts/MacPorts*.pkg \
    /Library/StartupItems/DarwinPortsStartup \
    /Library/Tcl/darwinports1.0 \
    /Library/Tcl/macports1.0 \
    ~/.macports

之后,您需要使用sudo rm /usr/local/bin/curl删除curl。

操作系统X中已包含

curllibcurl,但/usr/local/bin之前/usr/bin位于您的路径中。因此,在某些时候,您可能已安装了一个新版本的curl,其中包含MacPorts,现在已经遗留下来。

因此,您需要完全清除curl中的/usr/local内容。这可能最终有点棘手,如果你没有安装Homebrew,那么在重新安装Homebrew之前完全清除Homebrew并手动清理/usr/local可能是个好主意。

最后,一旦curl消失,您将需要删除依赖于libcurl的gem并重新安装。

如果在卸载MacPorts之前使用MacPorts卸载curl,可能已经避免了所有这些,但我自己从未使用过MacPorts,因此不是100%使用MacPorts。