未加载库:/usr/local/opt/openssl/lib/libssl.1.0.0.dylib (LoadError)

Posted

技术标签:

【中文标题】未加载库:/usr/local/opt/openssl/lib/libssl.1.0.0.dylib (LoadError)【英文标题】:Library not loaded: /usr/local/opt/openssl/lib/libssl.1.0.0.dylib (LoadError) 【发布时间】:2020-05-11 05:41:15 【问题描述】:

我之前曾尝试为应用程序制作新的 Rails 后端。 当我尝试 cd 进入应用程序时,终端显示:rvm install "ruby-2.6.5"

当我尝试安装它时,我得到了一个错误:

运行“__rvm_make -j8”时出错,

所以,我正在尝试切换到另一个以前工作的应用程序,它以 rails 作为后端。

我安装了两个 ruby​​ 版本:2.3.7 和 2.6.1 - 2.6.1 是当前版本。

我正在尝试运行 rails 服务器,当我这样做时 - 终端中的以下错误是我得到的:

    57: from bin/rails:3:in `<main>'
    56: from bin/rails:3:in `load'
    55: from /Users/yoyotoo/Desktop/flatiron/pets/pets_backend/bin/spring:15:in `<top (required)>'
    54: from /Users/yoyotoo/Desktop/flatiron/pets/pets_backend/bin/spring:15:in `require'
    53: from /Users/yoyotoo/.rvm/gems/ruby-2.6.1/gems/spring-2.1.0/lib/spring/binstub.rb:11:in `<top (required)>'
    52: from /Users/yoyotoo/.rvm/gems/ruby-2.6.1/gems/spring-2.1.0/lib/spring/binstub.rb:11:in `load'
    51: from /Users/yoyotoo/.rvm/gems/ruby-2.6.1/gems/spring-2.1.0/bin/spring:49:in `<top (required)>'
    50: from /Users/yoyotoo/.rvm/gems/ruby-2.6.1/gems/spring-2.1.0/lib/spring/client.rb:30:in `run'
    49: from /Users/yoyotoo/.rvm/gems/ruby-2.6.1/gems/spring-2.1.0/lib/spring/client/command.rb:7:in `call'
    48: from /Users/yoyotoo/.rvm/gems/ruby-2.6.1/gems/spring-2.1.0/lib/spring/client/rails.rb:28:in `call'
    47: from /Users/yoyotoo/.rvm/gems/ruby-2.6.1/gems/spring-2.1.0/lib/spring/client/rails.rb:28:in `load'
    46: from /Users/yoyotoo/Desktop/flatiron/pets/pets_backend/bin/rails:9:in `<top (required)>'
    45: from /Users/yoyotoo/.rvm/gems/ruby-2.6.1/gems/activesupport-6.0.0/lib/active_support/dependencies.rb:325:in `require'
    44: from /Users/yoyotoo/.rvm/gems/ruby-2.6.1/gems/activesupport-6.0.0/lib/active_support/dependencies.rb:291:in `load_dependency'
    43: from /Users/yoyotoo/.rvm/gems/ruby-2.6.1/gems/activesupport-6.0.0/lib/active_support/dependencies.rb:325:in `block in require'
    42: from /Users/yoyotoo/.rvm/gems/ruby-2.6.1/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
    41: from /Users/yoyotoo/.rvm/gems/ruby-2.6.1/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `require_with_bootsnap_lfi'
    40: from /Users/yoyotoo/.rvm/gems/ruby-2.6.1/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
    39: from /Users/yoyotoo/.rvm/gems/ruby-2.6.1/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `block in require_with_bootsnap_lfi'
    38: from /Users/yoyotoo/.rvm/gems/ruby-2.6.1/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require'
    37: from /Users/yoyotoo/.rvm/gems/ruby-2.6.1/gems/railties-6.0.0/lib/rails/commands.rb:18:in `<main>'
    36: from /Users/yoyotoo/.rvm/gems/ruby-2.6.1/gems/railties-6.0.0/lib/rails/command.rb:46:in `invoke'
    35: from /Users/yoyotoo/.rvm/gems/ruby-2.6.1/gems/railties-6.0.0/lib/rails/command/base.rb:65:in `perform'
    34: from /Users/yoyotoo/.rvm/gems/ruby-2.6.1/gems/thor-0.20.3/lib/thor.rb:387:in `dispatch'
    33: from /Users/yoyotoo/.rvm/gems/ruby-2.6.1/gems/thor-0.20.3/lib/thor/invocation.rb:126:in `invoke_command'
    32: from /Users/yoyotoo/.rvm/gems/ruby-2.6.1/gems/thor-0.20.3/lib/thor/command.rb:27:in `run'
    31: from /Users/yoyotoo/.rvm/gems/ruby-2.6.1/gems/railties-6.0.0/lib/rails/commands/server/server_command.rb:138:in `perform'
    30: from /Users/yoyotoo/.rvm/gems/ruby-2.6.1/gems/railties-6.0.0/lib/rails/commands/server/server_command.rb:138:in `tap'
    29: from /Users/yoyotoo/.rvm/gems/ruby-2.6.1/gems/railties-6.0.0/lib/rails/commands/server/server_command.rb:141:in `block in perform'
    28: from /Users/yoyotoo/.rvm/gems/ruby-2.6.1/gems/activesupport-6.0.0/lib/active_support/dependencies.rb:325:in `require'
    27: from /Users/yoyotoo/.rvm/gems/ruby-2.6.1/gems/activesupport-6.0.0/lib/active_support/dependencies.rb:291:in `load_dependency'
    26: from /Users/yoyotoo/.rvm/gems/ruby-2.6.1/gems/activesupport-6.0.0/lib/active_support/dependencies.rb:325:in `block in require'
    25: from /Users/yoyotoo/.rvm/gems/ruby-2.6.1/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
    24: from /Users/yoyotoo/.rvm/gems/ruby-2.6.1/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `require_with_bootsnap_lfi'
    23: from /Users/yoyotoo/.rvm/gems/ruby-2.6.1/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
    22: from /Users/yoyotoo/.rvm/gems/ruby-2.6.1/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `block in require_with_bootsnap_lfi'
    21: from /Users/yoyotoo/.rvm/gems/ruby-2.6.1/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require'
    20: from /Users/yoyotoo/Desktop/flatiron/pets/pets_backend/config/application.rb:7:in `<main>'
    19: from /Users/yoyotoo/.rvm/gems/ruby-2.6.1/gems/bundler-2.0.2/lib/bundler.rb:114:in `require'
    18: from /Users/yoyotoo/.rvm/gems/ruby-2.6.1/gems/bundler-2.0.2/lib/bundler/runtime.rb:65:in `require'
    17: from /Users/yoyotoo/.rvm/gems/ruby-2.6.1/gems/bundler-2.0.2/lib/bundler/runtime.rb:65:in `each'
    16: from /Users/yoyotoo/.rvm/gems/ruby-2.6.1/gems/bundler-2.0.2/lib/bundler/runtime.rb:76:in `block in require'
    15: from /Users/yoyotoo/.rvm/gems/ruby-2.6.1/gems/bundler-2.0.2/lib/bundler/runtime.rb:76:in `each'
    14: from /Users/yoyotoo/.rvm/gems/ruby-2.6.1/gems/bundler-2.0.2/lib/bundler/runtime.rb:81:in `block (2 levels) in require'
    13: from /Users/yoyotoo/.rvm/gems/ruby-2.6.1/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
    12: from /Users/yoyotoo/.rvm/gems/ruby-2.6.1/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `require_with_bootsnap_lfi'
    11: from /Users/yoyotoo/.rvm/gems/ruby-2.6.1/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
    10: from /Users/yoyotoo/.rvm/gems/ruby-2.6.1/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `block in require_with_bootsnap_lfi'
     9: from /Users/yoyotoo/.rvm/gems/ruby-2.6.1/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require'
     8: from /Users/yoyotoo/.rvm/gems/ruby-2.6.1/gems/pg-1.1.4/lib/pg.rb:4:in `<main>'
     7: from /Users/yoyotoo/.rvm/gems/ruby-2.6.1/gems/activesupport-6.0.0/lib/active_support/dependencies.rb:325:in `require'
     6: from /Users/yoyotoo/.rvm/gems/ruby-2.6.1/gems/activesupport-6.0.0/lib/active_support/dependencies.rb:291:in `load_dependency'
     5: from /Users/yoyotoo/.rvm/gems/ruby-2.6.1/gems/activesupport-6.0.0/lib/active_support/dependencies.rb:325:in `block in require'
     4: from /Users/yoyotoo/.rvm/gems/ruby-2.6.1/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
     3: from /Users/yoyotoo/.rvm/gems/ruby-2.6.1/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `require_with_bootsnap_lfi'
     2: from /Users/yoyotoo/.rvm/gems/ruby-2.6.1/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
     1: from /Users/yoyotoo/.rvm/gems/ruby-2.6.1/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `block in require_with_bootsnap_lfi'
/Users/yoyotoo/.rvm/gems/ruby-2.6.1/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require': dlopen(/Users/yoyotoo/.rvm/gems/ruby-2.6.1/gems/pg-1.1.4/lib/pg_ext.bundle, 9): Library not loaded: /usr/local/opt/openssl/lib/libssl.1.0.0.dylib (LoadError)
  Referenced from: /usr/local/opt/postgresql/lib/libpq.5.dylib
  Reason: image not found - /Users/yoyotoo/.rvm/gems/ruby-2.6.1/gems/pg-1.1.4/lib/pg_ext.bundle```

please help! thanks!


【问题讨论】:

一目了然,需要brew installopenssl和postgresql然后重新安装pg gem。 谢谢!不过没用;(openssl和postgresql都重新安装了,然后我安装了pg gem。 你是如何重新安装 pg 的?你是 gem 卸载/gem 安装,还是你 gem 卸载然后捆绑安装?应该通过 bundle install 来完成。 谢谢!!!是的,捆绑安装工作。如果您有时间/不介意,您能否解释一下终端错误以及您如何知道该怎么做? gem uninstall/gem install 处理全局 gem,bundle install 处理为您的特定应用程序安装和引用 gem。查看文件的最后一行,它说pg-1.1.4 存在问题,表明引用正确的pg gem 有问题。 【参考方案1】:

如果其他人像我一样遇到这个错误,这对我有用:

ln -s /usr/local/opt/openssl/lib/libssl.dylib /usr/local/opt/openssl/lib/libssl.1.0.0.dylib
ln -s /usr/local/opt/openssl/lib/libcrypto.1.1.dylib /usr/local/opt/openssl/lib/libcrypto.1.0.0.dylib

之后一切正常。我猜这个库引用了一些旧的 dylib 文件,并且可以在您的系统上安装新的文件。

【讨论】:

非常有用。谢谢@Jay El-Kaake 天才!您的解决方案就像一个魅力,非常感谢!我想知道你是如何达到这个解决方案的。我的意思是为什么我只是此类解决方案的复制粘贴:) 我应该阅读什么才能找到这样的解决方案,即使它们在 SO 上不可用。 脏。工作直到库中缺少某些东西dyld: Symbol not found: _SSL_library_init【参考方案2】:

对我来说,我不得不

brew uninstall postgres
brew install postgres

gem uninstall pg
bundle install

【讨论】:

重新安装 postgres 为我解决了这个问题。我在 psycopg2 中使用 python。【参考方案3】:

对我来说,只需安装适当版本的 openssl 即可。

brew install https://github.com/tebelorg/Tump/releases/download/v1.0.0/openssl.rb

参考:https://github.com/kelaberetiv/TagUI/issues/86

【讨论】:

禁止从任意 URL 调用非校验和下载 openssl 公式文件!使用 'brew extract' 或 'brew create' 和 'brew tap-new' 在 GitHub 上的 tap 中创建公式文件。 如@AlxVallejo 所述,您不能直接从 GitHub 进行 brew 安装 - 请按照此处的说明使用此方法进行安装 - github.com/tebelorg/Tump/issues/1#issuecomment-701530062【参考方案4】:

我的系统上安装了openssl1.1,但rails 不知何故使用了旧的引用,即/usr/local/opt/openssl/lib/libssl.1.0.0.dylib (LoadError),但这在我的Mojave 14 上不存在。

我尝试了以下解决方案,但没有成功:

    brew switch openssl 1.0.2t(错误:未知命令:开关) 重新安装 openssl 将openssl的版本降级到1.0 重新安装 rvm 和 ruby​​

最后,以下解决方案有效:

cp /usr/local/opt/openssl/lib/libssl.1.1.dylib /usr/local/opt/openssl/lib/libssl.1.0.0.dylib
cp /usr/local/opt/openssl/lib/libcrypto.1.1.dylib /usr/local/opt/openssl/lib/libcrypto.1.0.0.dylib

只需将新的 openssl 链接复制到旧的链接

【讨论】:

以上是关于未加载库:/usr/local/opt/openssl/lib/libssl.1.0.0.dylib (LoadError)的主要内容,如果未能解决你的问题,请参考以下文章

未加载库/未找到图像 - Swift 4.0

应用程序崩溃 - 未加载 AuthenticationServices 库

如何解决库未加载的错误?

未加载库:@rpath/libswiftSwiftOnoneSupport.dylib

尝试使用 dlopen 加载库时未定义的符号

动态加载库的未定义符号“typeinfo”