OpenSSL error installing Ruby 2.1.x and 2.3.x on Archlinux with ruby-install/ruby-build OpenSSL error installing Ruby 2.1.x and 2.3.x on Archlinux with ruby-install/ruby-build ruby ruby

OpenSSL error installing Ruby 2.1.x and 2.3.x on Archlinux with ruby-install/ruby-build


If not already installed you need Open SSL 1.0:

pacman -S openssl-1.0

For installing Ruby 2.3.x the following is needed:

PKG_CONFIG_PATH=/usr/lib/openssl-1.0/pkgconfig ruby-install ruby 2.3.0

I installed 2.3.0, 2.3.1 and 2.3.4 this way.

I'm using ruby-install but the same probably applies to ruby-build (rbenv).

For Ruby 2.1.x and 2.2.x a patch is also needed:

curl -fsSL https://gist.github.com/mislav/055441129184a1512bb5.txt > ruby2.x-openssl.patchPKG_CONFIG_PATH=/usr/lib/openssl-1.0/pkgconfig ruby-install -p ruby2.x-openssl.patch ruby 2.1.5

I installed 2.1.5 and 2.1.6 this way.

For older versions of Ruby (< 2) a different patch may be needed which can be downloaded here:

https://github.com/rbenv/ruby-build/wiki#openssl-sslv3_method-undeclared-error

Corrupted memory and Segfaults when compiling ruby

If you get segfaults when compiling, it might be because of the latest version of gcc. A workaround is to install an older version and then specify it to ruby-install:

sudo pacman -S gcc5CC=/usr/sbin/gcc-5 PKG_CONFIG_PATH=/usr/lib/openssl-1.0/pkgconfig ruby-install ruby 2.3.0

Reference: https://github.com/rbenv/ruby-build/issues/1092