Posted 7 months ago. Visible to the public.

How to fix: Rbenv fails to install Ruby 1.8.7 with OpenSSL

Installing ruby 1.8.7 with rbenv might fail if you have installed libssl-dev instead of libssl1.0-dev (default in Ubuntu 18.04).

Run sudo apt install libssl1.0-dev to remove libssl-dev and add libssl1.0-dev.

You can check installed libssl packages using apt list:

Copy
$ apt list --installed | grep libssl WARNING: apt does not have a stable CLI interface. Use with caution in scripts. libssl-dev/bionic,now 1.1.0g-2ubuntu4 amd64 [installed] libssl-doc/bionic,bionic,now 1.1.0g-2ubuntu4 all [installed,automatic] libssl1.0.0/bionic,now 1.0.2n-1ubuntu5 amd64 [installed] libssl1.1/bionic,now 1.1.0g-2ubuntu4 amd64 [installed]

Next, install Ruby like this:

Copy
CONFIGURE_OPTS="--with-readline-dir=/usr/include/readline --with-openssl-dir=/usr/include/openssl" rbenv install 1.8.7-p375

Here is what installation will look like when it fails.

Copy
Checking out http://svn.ruby-lang.org/repos/ruby/branches/ruby_1_8_7... Installing ruby-1.8.7-p375... WARNING: ruby-1.8.7-p375 is past its end of life and is now unsupported. It no longer receives bug fixes or critical security updates. BUILD FAILED (Ubuntu 18.04 using ruby-build 20180424) Inspect or clean up the working tree at /tmp/ruby-build.20180507142116.3799 Results logged to /tmp/ruby-build.20180507142116.3799.log Last 10 log lines: ^ ossl_ssl.c: In function ‘ossl_ssl_get_cipher’: ossl_ssl.c:1230:12: warning: assignment discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers] cipher = SSL_get_current_cipher(ssl); ^ Makefile:198: recipe for target 'ossl_ssl.o' failed make[1]: *** [ossl_ssl.o] Error 1 make[1]: Leaving directory '/tmp/ruby-build.20180507142116.3799/ruby-1.8.7-p375/ext/openssl' Makefile:293: recipe for target 'all' failed make: *** [all] Error 1
Growing Rails Applications in Practice
Check out our new e-book:
Learn to structure large Ruby on Rails codebases with the tools you already know and love.

Owner of this card:

Avatar
Emanuel De
Last edit:
6 months ago
by Arne Hartherz
About this deck:
We are makandra and do test-driven, agile Ruby on Rails software development.
License for source code
Posted by Emanuel De to makandra dev
This website uses cookies to improve usability and analyze traffic.
Accept or learn more