rbenv / ruby-build

A tool to download, compile, and install Ruby on Unix-like systems.
https://rbenv.org/man/ruby-build.1
MIT License
3.89k stars 785 forks source link

Ruby 2.2.10 install fails due to OpenSSL issue #2358

Closed tsvallender closed 8 months ago

tsvallender commented 8 months ago

I’m attempting to install this ancient version of Ruby and hitting this issue.

Initial output of rbenv install:

==> Downloading openssl-1.0.2u.tar.gz...
-> curl -q -fL -o openssl-1.0.2u.tar.gz https://dqw8nmjcqpjn7.cloudfront.net/ecd0c6ffb493dd06707d38b14bb4d8c2288bb7033735606569d8f90f89669
d16
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 5229k  100 5229k    0     0  30.2M      0 --:--:-- --:--:-- --:--:-- 30.4M
==> Installing openssl-1.0.2u...
-> ./config "--prefix=$HOME/.rbenv/versions/2.2.10/openssl" "--openssldir=$HOME/.rbenv/versions/2.2.10/openssl/ssl" zlib-dynamic no-ssl3 s
hared no-ssl2 no-krb5
-> make -j 32
-> make install_sw
==> Installed openssl-1.0.2u to /home/tsv/.rbenv/versions/2.2.10
==> Downloading ruby-2.2.10.tar.bz2...
-> curl -q -fL -o ruby-2.2.10.tar.bz2 https://cache.ruby-lang.org/pub/ruby/2.2/ruby-2.2.10.tar.bz2
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 12.7M  100 12.7M    0     0  26.9M      0 --:--:-- --:--:-- --:--:-- 26.9M
==> Installing ruby-2.2.10...

WARNING: ruby-2.2.10 is past its end of life and is now unsupported.
It no longer receives bug fixes or critical security updates.

-> ./configure "--prefix=$HOME/.rbenv/versions/2.2.10" "--with-openssl-dir=$HOME/.rbenv/versions/2.2.10/openssl"
-> make -j 32
-> make install

BUILD FAILED (openSUSE Tumbleweed 20240314 on x86_64 using ruby-build 20240221)

You can inspect the build directory at /tmp/ruby-build.20240318154710.5688.egFgj5
See the full build log at /tmp/ruby-build.20240318154710.5688.log

The referenced log file ends with:

/tmp/ruby-build.20240318154710.5688.egFgj5/ruby-2.2.10/lib/rubygems/core_ext/kernel_require.rb:54:in `require': libssl.so.1.0.0: cannot open shared object file: No such file or directory - /tmp/ruby-build.20240318154710.5688.egFgj5/ruby-2.2.10/.ext/x86_64-linux/openssl.so (LoadError)
        from /tmp/ruby-build.20240318154710.5688.egFgj5/ruby-2.2.10/lib/rubygems/core_ext/kernel_require.rb:54:in `require'
        from /tmp/ruby-build.20240318154710.5688.egFgj5/ruby-2.2.10/.ext/common/openssl.rb:17:in `<top (required)>'
        from /tmp/ruby-build.20240318154710.5688.egFgj5/ruby-2.2.10/lib/rubygems/core_ext/kernel_require.rb:54:in `require'
        from /tmp/ruby-build.20240318154710.5688.egFgj5/ruby-2.2.10/lib/rubygems/core_ext/kernel_require.rb:54:in `require'
        from /tmp/ruby-build.20240318154710.5688.egFgj5/ruby-2.2.10/lib/rubygems/security.rb:11:in `<top (required)>'
        from /tmp/ruby-build.20240318154710.5688.egFgj5/ruby-2.2.10/lib/rubygems/core_ext/kernel_require.rb:54:in `require'
        from /tmp/ruby-build.20240318154710.5688.egFgj5/ruby-2.2.10/lib/rubygems/core_ext/kernel_require.rb:54:in `require'
        from /tmp/ruby-build.20240318154710.5688.egFgj5/ruby-2.2.10/lib/rubygems/package.rb:43:in `<top (required)>'
        from /tmp/ruby-build.20240318154710.5688.egFgj5/ruby-2.2.10/lib/rubygems/core_ext/kernel_require.rb:54:in `require'
        from /tmp/ruby-build.20240318154710.5688.egFgj5/ruby-2.2.10/lib/rubygems/core_ext/kernel_require.rb:54:in `require'
        from /tmp/ruby-build.20240318154710.5688.egFgj5/ruby-2.2.10/lib/rubygems/dependency_installer.rb:3:in `<top (required)>'
        from /tmp/ruby-build.20240318154710.5688.egFgj5/ruby-2.2.10/lib/rubygems/core_ext/kernel_require.rb:54:in `require'
        from /tmp/ruby-build.20240318154710.5688.egFgj5/ruby-2.2.10/lib/rubygems/core_ext/kernel_require.rb:54:in `require'
        from /tmp/ruby-build.20240318154710.5688.egFgj5/ruby-2.2.10/lib/rubygems.rb:556:in `install'
        from ./tool/rbinstall.rb:722:in `block (2 levels) in <main>'
        from ./tool/rbinstall.rb:721:in `each'
        from ./tool/rbinstall.rb:721:in `block in <main>'
        from ./tool/rbinstall.rb:757:in `call'
        from ./tool/rbinstall.rb:757:in `block in <main>'
        from ./tool/rbinstall.rb:754:in `each'
        from ./tool/rbinstall.rb:754:in `<main>'
make: *** [uncommon.mk:246: do-install-all] Error 1
external command failed with status 2
/tmp/ruby-1build.20240318154710.5688.egFgj5/ruby2.2.10/.ext/x86_64-linux/openssl.so

The file /tmp/rubybuild.20240318154710.5688.egFgj5/ruby2.2.10/.ext/x86_64linux/openssl.so does exist, however. Is that the file it’s claiming doesn’t exist?

tsvallender commented 8 months ago

After a little more investigation, this is likely relevant:

ldd /tmp/ruby-build.20240319084848.25667.bjUEBD/ruby-2.2.10/.ext/x86_64-linux/openssl.so 
        linux-vdso.so.1 (0x00007ffcd4b29000)
        libssl.so.1.0.0 => not found
        libcrypto.so.1.0.0 => not found
        libcrypt.so.1 => /lib64/libcrypt.so.1 (0x00007fb10c8a8000)
        libm.so.6 => /lib64/libm.so.6 (0x00007fb10c7bf000)
        libc.so.6 => /lib64/libc.so.6 (0x00007fb10c400000)
        /lib64/ld-linux-x86-64.so.2 (0x00007fb10c94e000)
tsvallender commented 8 months ago

After manually installing the same version of OpenSSL in /opt, I’ve managed to get the Ruby version installed with the following:

LD_LIBRARY_PATH=/opt/openssl-1.0.2u/lib/ RUBY_CONFIGURE_OPTS=--with-openssl-dir=/opt/openssl-1.0.2u/ rbenv install

Is it possible to get rbenv doing this automatically?

mislav commented 8 months ago

Is it possible to get rbenv doing this automatically?

Hi, thanks for sharing the problem and how you solved it. It's possible that we could amend LD_LIBRARY_PATH from rbenv, but seeing how only Ruby 2.2 is affected (that we know so far) and that that version is many years past its End of Life, I would vote that we make no changes to ruby-build and offset this responsibility to the user. Old versions of Ruby (and old versions of OpenSSL that it needs) are notoriously difficult to compile on modern platforms and we don't really have the resources to flawlessly support compiling them from ruby-build.

If you encounter this or similar problem when compiling a more recent version of Ruby, we can consider setting better defaults for environment variables from ruby-build if that would help the user.