【问题标题】:mysql2 gem insisting on using openssl 1.0 instead of 1.1mysql2 gem 坚持使用 openssl 1.0 而不是 1.1
【发布时间】:2020-06-16 10:49:56
【问题描述】:

我最近将 openssl 更新到 1.1,并为我们的一款 Rails 应用重新安装了 ruby​​ 2.5.3。

但是我得到了错误:

/Users/cameron/.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require': dlopen(/Users/cameron/.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/gems/mysql2-0.4.10/lib/mysql2/mysql2.bundle, 9): Library not loaded: /usr/local/opt/openssl/lib/libssl.1.0.0.dylib (LoadError)
  Referenced from: /usr/local/opt/mysql/lib/libmysqlclient.20.dylib
  Reason: image not found - /Users/cameron/.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/gems/mysql2-0.4.10/lib/mysql2/mysql2.bundle

在我的.zshrc 中,我的路径中有以下内容:

export PATH="/usr/local/opt/openssl@1.1/bin:$PATH"
export LDFLAGS="-L/usr/local/opt/openssl@1.1/lib"
export CPPFLAGS="-I/usr/local/opt/openssl@1.1/include"

我已经尝试卸载 mysql2 并像这样重新安装:

gem install mysql2 -v 0.4.10 -- --with-cflags=\"-I/usr/local/opt/openssl@1.1/include\" --with-ldflags=\"-L/usr/local/opt/openssl@1.1/lib\"

但错误不断出现......

为什么 mysql2 gem 仍然尝试使用1.0.0 而不是1.1

【问题讨论】:

    标签: ruby openssl


    【解决方案1】:

    对于遇到此问题的任何人...修复相当烦人但很简单。

    确实做到了:

    source ~/.zshrcsource ~/.bash_profile

    您甚至不需要使用--with-cflags --with-ldflags... 并重新安装您的mysql2 gem。将您的个人资料与路径中的 openssl 重新链接后,一个简单的 bundle install 就足够了,一切都会再次运行!

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-12-13
      • 2016-02-13
      • 2015-12-30
      • 1970-01-01
      • 2020-03-28
      • 1970-01-01
      相关资源
      最近更新 更多