mysql2 gem 坚持使用 openssl 1.0 而不是 1.1
mysql2 gem insisting on using openssl 1.0 instead of 1.1
我最近将 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
?
对于遇到此问题的任何人...修复相当烦人但很简单。
从字面上看:
source ~/.zshrc
或 source ~/.bash_profile
您甚至不需要使用 --with-cflags --with-ldflags
... 并重新安装您的 mysql2 gem。一旦您将您的配置文件与路径中的 openssl 重新链接,一个简单的 bundle install
就足够了,一切都会再次运行!
我最近将 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
?
对于遇到此问题的任何人...修复相当烦人但很简单。
从字面上看:
source ~/.zshrc
或 source ~/.bash_profile
您甚至不需要使用 --with-cflags --with-ldflags
... 并重新安装您的 mysql2 gem。一旦您将您的配置文件与路径中的 openssl 重新链接,一个简单的 bundle install
就足够了,一切都会再次运行!