[英]cannot open shared object file: No such file or directory - /usr/local/bundle/gems/mysql2-0.5.3/lib/mysql2/mysql2.so (LoadError) when launching Rails
I'm trying to build and launch a Rails 6 container using mysql2 gem.我正在尝试使用 mysql2 gem 构建和启动 Rails 6 容器。 Everything builds fine but when I go to launch the Rails server, I get the error
一切正常,但是当我 go 启动 Rails 服务器时,出现错误
/usr/local/bundle/gems/activesupport-6.0.3.6/lib/active_support/dependencies.rb:324:in `require': libmariadb.so.3: cannot open shared object file: No such file or directory - /usr/local/bundle/gems/mysql2-0.5.3/lib/mysql2/mysql2.so (LoadError)
The relevant part of my Dockerfile is where I'd install the native extensions.我的 Dockerfile 的相关部分是我安装本机扩展的地方。 I'm aware that MariaDB is also an option but I tried those too and got the same error.
我知道 MariaDB 也是一个选项,但我也尝试了这些并得到了同样的错误。
apt-get update -qq && apt-get install -y git openssh-client build-essential pkg-config default-mysql-client default-libmysqlclient-dev libsqlite3-dev ;\
I'm using mysql2 (0.5.3) and Rails 6.0.3.6我正在使用 mysql2 (0.5.3) 和 Rails 6.0.3.6
Anyone have any suggestions?有人有什么建议吗? I've probably spent a week on this, your help would be greatly appreciated.
我可能已经花了一个星期的时间,您的帮助将不胜感激。 Thanks!
谢谢!
I figured out the issue.我弄清楚了这个问题。
In my Dockerfile I had another FROM clause after my apt-get install.在我的 Dockerfile 中,我在 apt-get 安装后还有另一个 FROM 子句。 Doing that reset the scope of the file so those dependencies weren't available at runtime of the Rails server.
这样做会重置文件的 scope,因此这些依赖项在 Rails 服务器运行时不可用。 I removed that and it worked.
我删除了它并且它起作用了。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.