库未加载:尝试运行 Rails 服务器并连接到 mysql 时 libssl.1.1.dylib (LoadError)

发布于 2025-01-14 15:07:07 字数 1076 浏览 7 评论 0原文

最近,我将 MacOS 更新到了 Monterey 12.3,其中包括 xcode 的更新。

之后我无法运行我一直在开发的 Rails 应用程序。当我尝试启动服务器时,我不断收到此错误。

我尝试过以不同的方式安装和删除 mysql。两者都使用来自mysql网站的brew安装和DMG文件。

我可以通过命令行访问数据库实例,但我认为他们的问题是我无法从应用程序连接。还有其他人有类似的问题吗?

这是完整的错误

/Users/gus/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/activesupport-6.0.3.6/lib/active_support/dependencies.rb:324:in `require': dlopen(/Users/gus/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/mysql2-0.5.3/lib/mysql2/mysql2.bundle, 0x0009): Library not loaded: libssl.1.1.dylib (LoadError)
  Referenced from: /Users/gus/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/mysql2-0.5.3/lib/mysql2/mysql2.bundle
  Reason: tried: 'libssl.1.1.dylib' (no such file), '/usr/local/lib/libssl.1.1.dylib' (no such file), '/usr/lib/libssl.1.1.dylib' (no such file), '/Users/gus/gus_project/Gus2021/libssl.1.1.dylib' (no such file), '/usr/local/lib/libssl.1.1.dylib' (no such file), '/usr/lib/libssl.1.1.dylib' (no such file) - /Users/gus/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/mysql2-0.5.3/lib/mysql2/mysql2.bundle

Recently I updated my MacOS to Monterey 12.3 which included updates for xcode.

After that I am not able to run the rails application that I have been working on. I keep getting this error when I try to spin up the server.

I have tried installing and removing mysql different ways. Both using a brew install and DMG file from mysql website.

I am able to access the database instance through my command line but I think they issue is that it I can't connect from application. Anyone else having similar issues?

here is the full error

/Users/gus/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/activesupport-6.0.3.6/lib/active_support/dependencies.rb:324:in `require': dlopen(/Users/gus/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/mysql2-0.5.3/lib/mysql2/mysql2.bundle, 0x0009): Library not loaded: libssl.1.1.dylib (LoadError)
  Referenced from: /Users/gus/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/mysql2-0.5.3/lib/mysql2/mysql2.bundle
  Reason: tried: 'libssl.1.1.dylib' (no such file), '/usr/local/lib/libssl.1.1.dylib' (no such file), '/usr/lib/libssl.1.1.dylib' (no such file), '/Users/gus/gus_project/Gus2021/libssl.1.1.dylib' (no such file), '/usr/local/lib/libssl.1.1.dylib' (no such file), '/usr/lib/libssl.1.1.dylib' (no such file) - /Users/gus/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/mysql2-0.5.3/lib/mysql2/mysql2.bundle

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

時窥 2025-01-21 15:07:07
brew install [email protected]

执行所有导出路径操作,并确保链接 [电子邮件受保护]

brew link [email protected] --force
brew install [email protected]

Do all the export path things, and make sure to link [email protected]

brew link [email protected] --force
我最亲爱的 2025-01-21 15:07:07

如果有人遇到这个问题,这就是解决我的问题的方法。

需要更新 openssl 的路径。

gem install mysql2 -- --with-ldflags=-L/opt/homebrew/opt/[电子邮件受保护]/lib --with-cppflags=-I/opt/homebrew/opt/[电子邮件受保护]< /a>/include

bundle install

显然这是用于 openssl 安装brew 安装 版本 1.1

If anyone runs into this problem, this is what solved my issue.

paths to openssl needed to be updated.

gem install mysql2 -- --with-ldflags=-L/opt/homebrew/opt/[email protected]/lib --with-cppflags=-I/opt/homebrew/opt/[email protected]/include

bundle install

Obviously this is for openssl install with brew install version 1.1

太阳哥哥 2025-01-21 15:07:07

我能够让它工作:

brew install openssl

bundle config build.mysql2 -- 
--with-ldflags=-L/opt/homebrew/opt/[email protected]/lib
--with-cppflags=-I/opt/homebrew/opt/[email protected]/include

I was able to get it working with this:

brew install openssl

bundle config build.mysql2 -- 
--with-ldflags=-L/opt/homebrew/opt/[email protected]/lib
--with-cppflags=-I/opt/homebrew/opt/[email protected]/include
别再吹冷风 2025-01-21 15:07:07

我对 postgresql 也有类似的问题,它在运行 psql -d 数据库时引发错误:

Library not loaded: '/opt/homebrew/opt/[email protected]/lib/libssl.1.1.dylib'

在我的情况下,我有 openssl@3 和 openssl@ 解决方案是:

brew install [email protected]
brew link [email protected] --force

然后用自制程序重新安装 postgresql。

我还让我的 zshrc 导出以下 ENV 变量,尽管我不太确定它是否相关:

export PATH="/opt/homebrew/opt/[email protected]/bin:$PATH"
export LDFLAGS="-L/opt/homebrew/opt/[email protected]/lib"
export CPPFLAGS="-I/opt/homebrew/opt/[email protected]/include"
export PKG_CONFIG_PATH="/opt/homebrew/opt/[email protected]/lib/pkgconfig"

对于遇到与我相同问题的人!

I had similar issue with postgresql, which raises error while running psql -d database:

Library not loaded: '/opt/homebrew/opt/[email protected]/lib/libssl.1.1.dylib'

In my case which I have openssl@3 and openssl@ the solution is:

brew install [email protected]
brew link [email protected] --force

Then reinstall postgresql with homebrew.

I also had my zshrc exporting the following ENV variable though I'm not quite sure if it's related:

export PATH="/opt/homebrew/opt/[email protected]/bin:$PATH"
export LDFLAGS="-L/opt/homebrew/opt/[email protected]/lib"
export CPPFLAGS="-I/opt/homebrew/opt/[email protected]/include"
export PKG_CONFIG_PATH="/opt/homebrew/opt/[email protected]/lib/pkgconfig"

For someone who runs into the same issue as mine!

冰雪之触 2025-01-21 15:07:07

重新安装openssh后才可以使用。然后我仔细检查了 /usr/local/opt 是否存在无效链接并修复了它们。

brew reinstall openssh

got it working only after reinstalling openssh. Then I double-checked the /usr/local/opt for invalid links and fixed them.

brew reinstall openssh
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文