OpenSSL issues with Ruby 2.x.x - Solution for rbenv & asdf

Recently I switched back to Arch Linux after trying out Debian. By the way, I have encrypted my disk with LUKS. Everything worked fine. Except for one thing - installing any version of ruby below 2.4.0. Unfortunately, on Arch Linux we have OpenSSL version 1.1.0e preinstalled. In order to install Ruby < 2.4 you have to install OpenSSL 1.0.x or making some patches. I went the easy path. I've installed linuxbrew and installed OpenSSL version 1.0.2k. Next step is to set configure option variable on the shell with pointing the path of installed OpenSSL 1.0.2k. If you know brew, then you know how easy it is to point to the installation path.

So firstly make sure you install linuxbrew. It is really the easiest way.

For rbenv:

1
CFLAGS="-O2" CONFIGURE_OPTS="--with-openssl-dir=`brew --prefix openssl`" rbenv install 2.3.4

For asdf:

1
CFLAGS="-O2" RUBY_CONFIGURE_OPTIONS="--with-openssl-dir=`brew --prefix openssl`" asdf install ruby 2.3.4

I've used the -O2 to optimize the compilation for code size and execution of ruby.

brew --prefix [package] returns absolute path of package where it is installed.

When you didn't hear about asdf. You should definitely check out when you program in many languages and have many different projects.

I hope it helped when you tackle kind of the same problem.

comments powered by Disqus