ruby - mysql2 gem 坚持使用 openssl 1.0 而不是 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
的就足够了,一切都会再次运行!
推荐阅读
- xcode - 当我们从全屏退出时,Vimeo 播放器使 ios ionic 应用程序崩溃
- java - 将变量从一个片段传递到另一个片段
- amazon-web-services - Boto3 列出 windows 实例使用的所有角色
- java - AWS Textract:线程“主”java.lang.NoSuchMethodError 中的异常
- python - Python:如何使用 struct 对对象的引用进行打包和解包?
- javascript - 添加新技能时技能列表不更新
- reactjs - 类似于 Excel 的复制粘贴功能,用于使用 react 和网格库将数据添加到网格中
- vue.js - 如何将 Vuex 存储中的变量作为值传递给函数?
- linux - `--quiet` CLI 选项的确切预期行为是什么?
- python - Python:编辑另一个用户打开的 xlsx 文件