如何在 ubuntu 20.04 上解决 ruby 2.7.4 的 "incompatible library version" 问题?
How can I solve "incompatible library version" problem with ruby 2.7.4 on ubuntu 20.04?
你好,这是我的第一个问题。
我正在尝试在我的服务器上构建一个 redmine 系统,但遇到了一些问题。
我的系统-ubuntu20.04 + nginx1.18 + mariadb10.3.30 + ruby2.7.4 + redmine4.2.2 / 使用rbenv安装ruby
当我尝试连接 redmine 服务器时,出现此错误
App 716658 output: Error: The application encountered the following error: libruby.so.2.7: cannot open shared object file: No such file or directory - /opt/redmine/vendor/cache/ruby/2.7.0/gems/mysql2-0.5.3/lib/mysql2/mysql2.so (LoadError)
所以我做到了
cd /usr/lib
ln -s /root/.rbenv/versions/2.7.4/lib/libruby.so.2.7 libruby.so.2.7
然后发生库版本不兼容的错误
App 722799 output: Error: The application encountered the following error: incompatible library version - /opt/redmine/vendor/cache/ruby/2.7.0/gems/mysql2-0.5.3/lib/mysql2/mysql2.so (LoadError)
我尝试了 gem pristine --all
但没有成功。
我该如何解决这个问题?出现了这么多错误,所以我想我的设置有问题。
gem 环境
- RUBYGEMS VERSION: 3.2.25
- RUBY VERSION: 2.7.4 (2021-07-07 patchlevel 191) [x86_64-linux]
- INSTALLATION DIRECTORY: /root/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0
- USER INSTALLATION DIRECTORY: /root/.gem/ruby/2.7.0
- RUBY EXECUTABLE: /root/.rbenv/versions/2.7.4/bin/ruby
- GIT EXECUTABLE: /usr/bin/git
- EXECUTABLE DIRECTORY: /root/.rbenv/versions/2.7.4/bin
- SPEC CACHE DIRECTORY: /root/.gem/specs
- SYSTEM CONFIGURATION DIRECTORY: /root/.rbenv/versions/2.7.4/etc
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-linux
- GEM PATHS:
- /root/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0
- /root/.gem/ruby/2.7.0
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- https://rubygems.org/
- SHELL PATH:
- /root/.rbenv/versions/2.7.4/bin
- /root/.rbenv/libexec
- /root/.rbenv/plugins/ruby-build/bin
- /root/.rbenv/shims
- /root/.rbenv/bin
- /usr/local/sbin
- /usr/local/bin
- /usr/sbin
- /usr/bin
- /sbin
- /bin
- /usr/games
- /usr/local/games
- /snap/bin
捆绑环境
Bundler 2.2.25
Platforms ruby, x86_64-linux
Ruby 2.7.4p191 (2021-07-07 revision a21a3b7d23704a01d34bd79d09dc37897e00922a) [x86_64-linux]
Full Path /root/.rbenv/versions/2.7.4/bin/ruby
Config Dir /root/.rbenv/versions/2.7.4/etc
RubyGems 3.2.25
Gem Home /root/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0
Gem Path /root/.gem/ruby/2.7.0:/root/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0
User Home /root
User Path /root/.gem/ruby/2.7.0
Bin Dir /root/.rbenv/versions/2.7.4/bin
Tools
Git 2.25.1
RVM not installed
rbenv rbenv 1.1.2-61-g585ed84
chruby not installed
Bundler 构建元数据
Built At 2021-07-30
Git SHA 7f0f257c7a
Released Version true
您似乎已经配置了捆绑器(Ruby 项目的 gem 版本管理器)以在与通常系统不同的位置为 Redmine 安装 gems gems,即到/opt/redmine/vendor/cache
.
因此,通常的 gem
命令不会触及那些安装了捆绑程序的 gem,因为 gem
不知道它们。要重新安装所有捆绑器管理的 gems,您可以 运行 在您的 Redmine 目录中执行以下命令(i/e/ 包含 Gemfile
的目录:
bundle pristine
这实际上与 gem pristine --all
相同,但仅适用于捆绑程序管理的 gem。有关详细信息,请参阅 the documentation。
你好,这是我的第一个问题。 我正在尝试在我的服务器上构建一个 redmine 系统,但遇到了一些问题。
我的系统-ubuntu20.04 + nginx1.18 + mariadb10.3.30 + ruby2.7.4 + redmine4.2.2 / 使用rbenv安装ruby
当我尝试连接 redmine 服务器时,出现此错误
App 716658 output: Error: The application encountered the following error: libruby.so.2.7: cannot open shared object file: No such file or directory - /opt/redmine/vendor/cache/ruby/2.7.0/gems/mysql2-0.5.3/lib/mysql2/mysql2.so (LoadError)
所以我做到了
cd /usr/lib
ln -s /root/.rbenv/versions/2.7.4/lib/libruby.so.2.7 libruby.so.2.7
然后发生库版本不兼容的错误
App 722799 output: Error: The application encountered the following error: incompatible library version - /opt/redmine/vendor/cache/ruby/2.7.0/gems/mysql2-0.5.3/lib/mysql2/mysql2.so (LoadError)
我尝试了 gem pristine --all
但没有成功。
我该如何解决这个问题?出现了这么多错误,所以我想我的设置有问题。
gem 环境
- RUBYGEMS VERSION: 3.2.25
- RUBY VERSION: 2.7.4 (2021-07-07 patchlevel 191) [x86_64-linux]
- INSTALLATION DIRECTORY: /root/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0
- USER INSTALLATION DIRECTORY: /root/.gem/ruby/2.7.0
- RUBY EXECUTABLE: /root/.rbenv/versions/2.7.4/bin/ruby
- GIT EXECUTABLE: /usr/bin/git
- EXECUTABLE DIRECTORY: /root/.rbenv/versions/2.7.4/bin
- SPEC CACHE DIRECTORY: /root/.gem/specs
- SYSTEM CONFIGURATION DIRECTORY: /root/.rbenv/versions/2.7.4/etc
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-linux
- GEM PATHS:
- /root/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0
- /root/.gem/ruby/2.7.0
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- https://rubygems.org/
- SHELL PATH:
- /root/.rbenv/versions/2.7.4/bin
- /root/.rbenv/libexec
- /root/.rbenv/plugins/ruby-build/bin
- /root/.rbenv/shims
- /root/.rbenv/bin
- /usr/local/sbin
- /usr/local/bin
- /usr/sbin
- /usr/bin
- /sbin
- /bin
- /usr/games
- /usr/local/games
- /snap/bin
捆绑环境
Bundler 2.2.25
Platforms ruby, x86_64-linux
Ruby 2.7.4p191 (2021-07-07 revision a21a3b7d23704a01d34bd79d09dc37897e00922a) [x86_64-linux]
Full Path /root/.rbenv/versions/2.7.4/bin/ruby
Config Dir /root/.rbenv/versions/2.7.4/etc
RubyGems 3.2.25
Gem Home /root/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0
Gem Path /root/.gem/ruby/2.7.0:/root/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0
User Home /root
User Path /root/.gem/ruby/2.7.0
Bin Dir /root/.rbenv/versions/2.7.4/bin
Tools
Git 2.25.1
RVM not installed
rbenv rbenv 1.1.2-61-g585ed84
chruby not installed
Bundler 构建元数据
Built At 2021-07-30
Git SHA 7f0f257c7a
Released Version true
您似乎已经配置了捆绑器(Ruby 项目的 gem 版本管理器)以在与通常系统不同的位置为 Redmine 安装 gems gems,即到/opt/redmine/vendor/cache
.
因此,通常的 gem
命令不会触及那些安装了捆绑程序的 gem,因为 gem
不知道它们。要重新安装所有捆绑器管理的 gems,您可以 运行 在您的 Redmine 目录中执行以下命令(i/e/ 包含 Gemfile
的目录:
bundle pristine
这实际上与 gem pristine --all
相同,但仅适用于捆绑程序管理的 gem。有关详细信息,请参阅 the documentation。