rbenv ruby​​ 2.7.2安装失败:“ BUILD FAILED”

问题描述

尝试使用rbenv安装ruby 2.7.2时遇到了这个奇怪的错误。

有人知道这个问题是什么吗?

$ rbenv install 2.7.2
Installing ruby-2.7.2...

BUILD FAILED (Ubuntu 20.04 using ruby-build 20201005-4-g4761049)

Inspect or clean up the working tree at /tmp/ruby-build.20201106211003.49727.I05SRV
Results logged to /tmp/ruby-build.20201106211003.49727.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

编辑:.log文件的内容如下(完整版本的长度为197'000行,所以我只能张贴最后一部分)。

最后,它说:

ruby-2.7.2/lib/rubygems/core_ext/kernel_require.rb:92:in `require': cannot load such file -- openssl (LoadError)

但是,我确实安装了openssl(我使用过)。我想念什么?

generating x86_64-linux-fake.rb
x86_64-linux-fake.rb updated
./miniruby -I./lib -I. -I.ext/common  ./tool/runruby.rb --extout=.ext  -- --disable-gems -r./x86_64-linux-fake ./tool/rbinstall.rb --make="make" --dest-dir="" --extout=".ext" --mflags="" --make-flags="" --data-mode=0644 --prog-mode=0755 --installed-list .installed.list --mantype="doc" --rdoc-output=".ext/rdoc" --html-output=".ext/html"
installing binary commands:         /home/tom/.rbenv/versions/2.7.2/bin
installing base libraries:          /home/tom/.rbenv/versions/2.7.2/lib
installing arch files:              /home/tom/.rbenv/versions/2.7.2/lib/ruby/2.7.0/x86_64-linux
installing pkgconfig data:          /home/tom/.rbenv/versions/2.7.2/lib/pkgconfig
installing extension objects:       /home/tom/.rbenv/versions/2.7.2/lib/ruby/2.7.0/x86_64-linux
installing extension objects:       /home/tom/.rbenv/versions/2.7.2/lib/ruby/site_ruby/2.7.0/x86_64-linux
installing extension objects:       /home/tom/.rbenv/versions/2.7.2/lib/ruby/vendor_ruby/2.7.0/x86_64-linux
installing extension headers:       /home/tom/.rbenv/versions/2.7.2/include/ruby-2.7.0/x86_64-linux
installing extension scripts:       /home/tom/.rbenv/versions/2.7.2/lib/ruby/2.7.0
installing extension scripts:       /home/tom/.rbenv/versions/2.7.2/lib/ruby/site_ruby/2.7.0
installing extension scripts:       /home/tom/.rbenv/versions/2.7.2/lib/ruby/vendor_ruby/2.7.0
installing extension headers:       /home/tom/.rbenv/versions/2.7.2/include/ruby-2.7.0/ruby
installing rdoc:                    /home/tom/.rbenv/versions/2.7.2/share/ri/2.7.0/system
installing html-docs:               /home/tom/.rbenv/versions/2.7.2/share/doc/ruby
installing capi-docs:               /home/tom/.rbenv/versions/2.7.2/share/doc/ruby
installing command scripts:         /home/tom/.rbenv/versions/2.7.2/bin
installing library scripts:         /home/tom/.rbenv/versions/2.7.2/lib/ruby/2.7.0
installing common headers:          /home/tom/.rbenv/versions/2.7.2/include/ruby-2.7.0
installing manpages:                /home/tom/.rbenv/versions/2.7.2/share/man (man1,man5)
installing default gems from lib:   /home/tom/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0 (build_info,cache,doc,extensions,gems,specifications)
                                    benchmark 0.1.0
/tmp/ruby-build.20201107153545.4938.VEdjtZ/ruby-2.7.2/lib/rubygems/core_ext/kernel_require.rb:92:in `require': cannot load such file -- openssl (LoadError)
    from /tmp/ruby-build.20201107153545.4938.VEdjtZ/ruby-2.7.2/lib/rubygems/core_ext/kernel_require.rb:92:in `require'
    from /tmp/ruby-build.20201107153545.4938.VEdjtZ/ruby-2.7.2/lib/rubygems/specification.rb:2430:in `to_ruby'
    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

解决方法

长话短说,我发现需要libssl-devlibreadline-dev,所以解决了这个问题:

sudo apt-get install libssl-dev libreadline-dev

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...