Some time ago, Archlinux switch to openssl 1.1. I’ll not discuss here the good or the bad of such a move, neither will I speak about the various crash it leads to (spotify, steam…). In fact, all the broken packages were AUR packages and proprietary stuff, often statically compiled against some libs and arbitrary depending on some others. In a perfect world, we do not have such a problem for these software as we should be able to compile them as we wish. But that is not the subject.
One of the collateral victim of this switch is the ruby ecosystem. Yes, if you do the things rights (and of course you do it), you don’t use the official ruby package, but one of the various userland ruby environment tools (rvm, rbenv…). If you do, you already know that each new openssl version obliged us to recompile our rubies. That was this easy:
rvm reinstall myruby
But with the openssl switch, we discover a bad situation: it is impossible to compile ruby version inferior to the 2.4 with openssl 1.1. If you have, like me, to maintain an application using ruby 2.1, 2.2 or 2.3, it became suddenly impossible to compile it.
After a long quest around the various compilation option and way to pass it to make through rvm, I finally found the solution.
First, you must have installed
openssl-1.0. Because we will build our rubies against it. Yes, you can have both
openssl installed on your system. Then, all we have to do is to export a bunch of variables before doing our rvm reinstall:
$ export PKG_CONFIG_PATH=/usr/lib/openssl-1.0/pkgconfig $ export CFLAGS="$CFLAGS -I/usr/include/openssl-1.0" $ export LDFLAGS="$LDFLAGS -L/usr/lib/openssl-1.0 -lssl" $ rvm reinstall ruby-2.1.2
And now you should have your ruby 2.1.2 running as before. You don’t need to pass any other environment variable before running it. You may have to reinstall some of your gem after that thought, and in most of the cases, it should be fixed with a simple
bundle install in your project repository.