0

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

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

/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
4

1 回答 1

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并且libcurl已经包含在 OS X 中,但/usr/local/bin/usr/bin. 因此,在某些时候,您可能安装了一个新版本的curlMacPorts,而现在还剩下。

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

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

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

于 2012-08-01T14:37:52.070 回答