[uncommon.mk:300: build-ext] Error 2 when installing RVM with older Ruby in Ubuntu 22.04

#programming #ruby #rvm

This happened to me when I was installing RVM because at the time I wrote this, Ruby 3.0 was the default version on the stable branch. However it'll continue to happen on Ruby versions lesser than 3.1 because Ubuntu 22.04 doesn't pack OpenSSL 1.1 anymore.

Before continuing, confirm if you really need older ruby versions. If not, use RVM's development branch.

If you need older Ruby versions, proceed

ruby-3.0.0 - #compiling................................................................................-
Error running '__rvm_make -j16',
please read /home/marcos/.rvm/log/1677512491_ruby-3.0.0/make.log

There has been an error while running make. Halting the installation.

You can install it (and earlier versions) using the following commands:

$ rvm pkg install openssl
$ rvm install ruby-3.0.0 --with-openssl-dir=$HOME/.rvm/usr

After installation, open a new console, do rvm use <version> and you're all set.

Please check sources for possible updates

Sources: * Cannot build rubies 2.6.x, 2.7.x and 3.0.x on Ubuntu 22.04 because they relies on openssl1.1 and Ubuntu now provides openssl3 * Cannot install ruby version 2.6.6 on Ubuntu 22.04