6

After upgrading to Ubuntu 22.04 (Jammy Jellyfish) I noticed problems with Ruby 2.7.2, so I attempted to install 2.7.2, and when that failed, 2.7.6, which also failed with the same error:

$ 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

The current version installs:

$ 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

Suggestions on how to get Ruby 2.7.x installed on Jammy Jellyfish?

2

1 Answer 1

5

Your problem is Ubuntu 22.04 comes installed with OpenSSL 3.0, but the error message in your build log states:

OpenSSL >= 1.0.1, < 3.0.0 or LibreSSL >= 2.5.0 is required

To fix this you need to compile OpenSSL yourself. See the instructions below.

Based on this information, I would think that the safest way to build Ruby on Ubuntu 22.04 would be: instead of depending on the system libssl-dev package, download and compile OpenSSL 1.1.1 into its own directory, then point to that directory with RUBY_CONFIGURE_OPTS=--with-openssl-dir=/path/to/my/openssl while compiling with ruby-build.

The answer was found here:
https://github.com/rbenv/ruby-build/discussions/1940

1
  • Nice! I will probably take a few days to digest this while I incorporate what you just demonstrated into a documentation project that I have been working on for some time. I will update the page below, starting tomorrow. I will check in my progress as it happens. Eventually, this will morph into something hopefully useful. I know I often find my own answers out on the interwebs, and I thank myself: mslinn.com/jekyll/1000-setting-up-github-pages.html
    – Mike Slinn
    Commented Apr 28, 2022 at 21:46

Not the answer you're looking for? Browse other questions tagged or ask your own question.