Search code examples
rubyrbenv

rbenv ruby 2.7.2 installation fails: "BUILD FAILED"


I am getting this strange error while trying to install ruby 2.7.2 using rbenv.

Does anybody know what the issue is?

$ 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

EDIT: Below is the content of the .log file (the full version is 197'000 lines long, so I can only post the last part).

And at the end, it says:

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

However, I DO have openssl installed (I use it). What am I missing?

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

Solution

  • Long story short, I found out that libssl-dev and libreadline-dev were required, so this solved the problem:

    sudo apt-get install libssl-dev libreadline-dev