升级到 Ubuntu 22.04 (Jammy Jellyfish) 后,我注意到 Ruby 2.7.2 存在问题,因此我尝试安装 2.7.2,当安装失败时,又安装了 2.7.6,它也失败并出现相同的错误:
$ rbenv install 2.7.6
Downloading ruby-2.7.6.tar.bz2...
-> https://cache.ruby-lang.org/pub/ruby/2.7/ruby-2.7.6.tar.bz2
Installing ruby-2.7.6...
BUILD FAILED (Ubuntu 22.04 using ruby-build 20220426)
Inspect or clean up the working tree at /tmp/ruby-build.20220428104457.2389.OeOKU9
Results logged to /tmp/ruby-build.20220428104457.2389.log
Last 10 log lines:
from ./tool/rbinstall.rb:846:in `block (2 levels) in install_default_gem'
from ./tool/rbinstall.rb:279:in `open_for_install'
from ./tool/rbinstall.rb:845:in `block in install_default_gem'
from ./tool/rbinstall.rb:835:in `each'
from ./tool/rbinstall.rb:835:in `install_default_gem'
from ./tool/rbinstall.rb:799:in `block in <main>'
from ./tool/rbinstall.rb:950:in `block in <main>'
from ./tool/rbinstall.rb:947:in `each'
from ./tool/rbinstall.rb:947:in `<main>'
make: *** [uncommon.mk:373: do-install-all] Error 1
当前版本安装:
$ rbenv install 3.1.2
Downloading ruby-3.1.2.tar.gz...
-> https://cache.ruby-lang.org/pub/ruby/3.1/ruby-3.1.2.tar.gz
Installing ruby-3.1.2...
Installed ruby-3.1.2 to /home/mslinn/.rbenv/versions/3.1.2
关于如何在 Jammy Jellyfish 上安装 Ruby 2.7.x 的建议?
您的问题是 Ubuntu 22.04 附带安装了 OpenSSL 3.0,但构建日志中的错误消息指出:
OpenSSL >= 1.0.1, < 3.0.0 or LibreSSL >= 2.5.0 is required
要解决此问题,您需要自己编译 OpenSSL。请参阅下面的说明。
根据这些信息,我认为在 Ubuntu 22.04 上构建 Ruby 最安全的方法是:而不是依赖系统 libssl-dev 包,下载 OpenSSL 1.1.1 并将其编译到其自己的目录中,然后使用以下命令指向该目录RUBY_CONFIGURE_OPTS=--with-openssl-dir=/path/to/my/openssl
使用 ruby-build 编译时.
答案在这里找到:
https://github.com/rbenv/ruby-build/discussions/1940 https://github.com/rbenv/ruby-build/discussions/1940
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)