OpenSSL无法通过gem rubygems、brew或bundle加载库

10

我使用的是brew 0.9.5,通过它我安装了rbenv 0.4.0和ruby-build,用于安装ruby 2.1.2。

已经有一段时间没有动过,最近进行了几次osx系统更新:

 bundle

提供:

/usr/local/Cellar/rbenv/versions/2.1.2/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:54:in `require': dlopen(/usr/local/Cellar/rbenv/versions/2.1.2/lib/ruby/2.1.0/x86_64-darwin13.0/digest/sha1.bundle, 9): Library not loaded: @@HOMEBREW_PREFIX@@/opt/openssl/lib/libcrypto.1.0.0.dylib (LoadError)
  Referenced from: /usr/local/Cellar/rbenv/versions/2.1.2/lib/ruby/2.1.0/x86_64-darwin13.0/digest/sha1.bundle
  Reason: image not found - /usr/local/Cellar/rbenv/versions/2.1.2/lib/ruby/2.1.0/x86_64-darwin13.0/digest/sha1.bundle
    from /usr/local/Cellar/rbenv/versions/2.1.2/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:54:in `require'
    from /usr/local/Cellar/rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/bundler-1.6.3/lib/bundler/definition.rb:1:in `<top (required)>'
    from /usr/local/Cellar/rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/bundler-1.6.3/lib/bundler.rb:153:in `definition'
    from /usr/local/Cellar/rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/bundler-1.6.3/lib/bundler/cli/install.rb:76:in `run'
    from /usr/local/Cellar/rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/bundler-1.6.3/lib/bundler/cli.rb:146:in `install'
    from /usr/local/Cellar/rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/bundler-1.6.3/lib/bundler/vendor/thor/command.rb:27:in `run'
    from /usr/local/Cellar/rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/bundler-1.6.3/lib/bundler/vendor/thor/invocation.rb:121:in `invoke_command'
    from /usr/local/Cellar/rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/bundler-1.6.3/lib/bundler/vendor/thor.rb:363:in `dispatch'
    from /usr/local/Cellar/rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/bundler-1.6.3/lib/bundler/vendor/thor/base.rb:440:in `start'
    from /usr/local/Cellar/rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/bundler-1.6.3/lib/bundler/cli.rb:9:in `start'
    from /usr/local/Cellar/rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/bundler-1.6.3/bin/bundle:20:in `block in <top (required)>'
    from /usr/local/Cellar/rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/bundler-1.6.3/lib/bundler/friendly_errors.rb:5:in `with_friendly_errors'
    from /usr/local/Cellar/rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/bundler-1.6.3/bin/bundle:20:in `<top (required)>'
    from /usr/local/Cellar/rbenv/versions/2.1.2/bin/bundle:23:in `load'
    from /usr/local/Cellar/rbenv/versions/2.1.2/bin/bundle:23:in `<main>'

我尝试使用brew卸载openssl并重新安装。

我尝试使用brew强制链接openssl。

我尝试升级所有内容。

到目前为止,没有任何作用。

我无法启动puma,bundle或更新gems。

gem update --system

ERROR:  Loading command: update (LoadError)
    dlopen(/usr/local/Cellar/rbenv/versions/2.1.2/lib/ruby/2.1.0/x86_64-darwin13.0/openssl.bundle, 9): Library not loaded: @@HOMEBREW_PREFIX@@/opt/openssl/lib/libssl.1.0.0.dylib
  Referenced from: /usr/local/Cellar/rbenv/versions/2.1.2/lib/ruby/2.1.0/x86_64-darwin13.0/openssl.bundle
  Reason: image not found - /usr/local/Cellar/rbenv/versions/2.1.2/lib/ruby/2.1.0/x86_64-darwin13.0/openssl.bundle
ERROR:  While executing gem ... (NoMethodError)
    undefined method `invoke_with_build_args' for nil:NilClass

gem -v:2.4.0

brew --env

HOMEBREW_CC: clang
HOMEBREW_CXX: clang++
MAKEFLAGS: -j4
CMAKE_PREFIX_PATH: /usr/local
CMAKE_INCLUDE_PATH: /usr/include/libxml2:/System/Library/Frameworks/OpenGL.framework/Versions/Current/Headers
CMAKE_LIBRARY_PATH: /System/Library/Frameworks/OpenGL.framework/Versions/Current/Libraries
PKG_CONFIG_LIBDIR: /usr/lib/pkgconfig:/usr/local/Library/ENV/pkgconfig/10.9
ACLOCAL_PATH: /usr/local/share/aclocal
PATH: /usr/local/Library/ENV/4.3:/usr/bin:/bin:/usr/sbin:/sbin


brew config

HOMEBREW_VERSION: 0.9.5
ORIGIN: https://github.com/Homebrew/homebrew.git
HEAD: 49e6d09f85a999a4a4d82b2d47bd837ed342d8cb
HOMEBREW_PREFIX: /usr/local
HOMEBREW_CELLAR: /usr/local/Cellar
CPU: quad-core 64-bit haswell
OS X: 10.9.5-x86_64
CLT: 6.0.0.0.1.1410400753
Clang: 6.0 build 600
X11: 2.7.6 => /opt/X11
System Ruby: 2.0.0-481
Perl: /usr/bin/perl
Python: /usr/bin/python
Ruby: /usr/local/Cellar/rbenv/shims/ruby

brew uses --installed openssl
postgresql  ruby-build

如果有人有线索,我会采纳的!

1个回答

39

不确定为什么和如何,但是:

rbenv install 2.1.2
rbenv: /usr/local/Cellar/rbenv/versions/2.1.2 already exists
continue with installation? (y/N) y

现在它可以工作了!只需要重新安装我的Ruby,就像重新连接OpenSSL一样......

现在我又可以工作了,但是为了更好地了解发生了什么,如果有人知道底层机制,我会很高兴听到的。


我也试过了,但是不知道为什么有效。 - Jordan
OP的问题中的错误输出包含“Library not loaded: @@HOMEBREW_PREFIX@@/opt/openssl/lib/libssl.1.0.0.dylib”,显示版本为1.0.0。当我运行rbenv install时,它问我是否仍要重新安装,请按y键。第一件事是什么?下载openssl-1.1.1g.tar.gz...。这个问题涉及openssl版本,在我的情况下是homebrew和OSX淘汰了openssl 1.0.0。 - legoblocks

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接