You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
$ RUBY_BUILD_VENDOR_OPENSSL=true ruby-build --verbose ruby-3.4.1 ~/.rubies/ruby-3.4.1-openssl-3.4.0
$ cd ~/.rubies/ruby-3.4.1-openssl-3.4.0/openssl
$ bin/openssl version
bin/openssl: /lib64/libssl.so.3: version `OPENSSL_3.4.0' not found (required by bin/openssl)
bin/openssl: /lib64/libssl.so.3: version `OPENSSL_3.2.0' not found (required by bin/openssl)
bin/openssl: /lib64/libcrypto.so.3: version `OPENSSL_3.3.0' not found (required by bin/openssl)
bin/openssl: /lib64/libcrypto.so.3: version `OPENSSL_3.4.0' not found (required by bin/openssl)
bin/openssl: /lib64/libcrypto.so.3: version `OPENSSL_3.2.0' not found (required by bin/openssl)
$ ldd bin/openssl
bin/openssl: /lib64/libssl.so.3: version `OPENSSL_3.4.0' not found (required by bin/openssl)
bin/openssl: /lib64/libssl.so.3: version `OPENSSL_3.2.0' not found (required by bin/openssl)
bin/openssl: /lib64/libcrypto.so.3: version `OPENSSL_3.3.0' not found (required by bin/openssl)
bin/openssl: /lib64/libcrypto.so.3: version `OPENSSL_3.4.0' not found (required by bin/openssl)
bin/openssl: /lib64/libcrypto.so.3: version `OPENSSL_3.2.0' not found (required by bin/openssl)
linux-vdso.so.1 (0x00007ffdc43e5000)
libssl.so.3 => /lib64/libssl.so.3 (0x00007fa625c4b000) <= BUG
libcrypto.so.3 => /lib64/libcrypto.so.3 (0x00007fa625600000) <= BUG
libc.so.6 => /lib64/libc.so.6 (0x00007fa62541e000)
libz.so.1 => /lib64/libz.so.1 (0x00007fa625c31000)
/lib64/ld-linux-x86-64.so.2 (0x00007fa625d0a000)
$ ldd lib/libssl.so
lib/libssl.so: /lib64/libcrypto.so.3: version `OPENSSL_3.3.0' not found (required by lib/libssl.so)
lib/libssl.so: /lib64/libcrypto.so.3: version `OPENSSL_3.4.0' not found (required by lib/libssl.so)
lib/libssl.so: /lib64/libcrypto.so.3: version `OPENSSL_3.2.0' not found (required by lib/libssl.so)
linux-vdso.so.1 (0x00007fffc97f4000)
libcrypto.so.3 => /lib64/libcrypto.so.3 (0x00007feaaca00000) <= BUG
libc.so.6 => /lib64/libc.so.6 (0x00007feaac81e000)
libz.so.1 => /lib64/libz.so.1 (0x00007feaad07b000)
/lib64/ld-linux-x86-64.so.2 (0x00007feaad1b5000)
I added <= BUG to the output to highlight the problematic lines.
So we see bin/openssl links to system libssl and system libcrypto, when it should link those inside the openssl prefix.
And also that the built libssl links to system libcrypto and not in-the-same-dir libcrypto.
Since the system openssl in this case is 3.1.4 it results in relatively clear errors, but if they were closer it could maybe crash or so.
Luckily this doesn't seem to affect the Ruby openssl extension, which links correctly to the correct libssl and libcrypto:
But that still seems brittle because I'm not sure it's guaranteed the libcrypto dependency there always wins over the dependency declared in libssl. Having them with different values certainly seems bad.
I also checked with ruby -ropen-uri -e 'puts URI.send(:open, %{https://rubygems.org/}) { |f| f.read(1024) }; sleep' and lsof and that looks fine, only the correct ibssl/libcrypto are loaded. But maybe by "chance".
I think it would be nice to fix this so the built openssl has correct library dependencies and we don't run the risk of these conflicting dependencies to stop working at some point.
I noticed this with OpenSSL 3.4 but I think it happens with older versions as well like 3.0.
FWIW this is the patch I used because I wanted to check against OpenSSL 3.4 specifically (for oracle/truffleruby#3724):
So CRuby build system adds /home/eregon/.rubies/ruby-3.4.1-openssl-3.4.0/lib to the runpath, that's likely what saves us (but I think it could still break if the library loader decides to load libcrypto from libssl first (instead of from openssl.so), where libssl has no runpath and so it'd pick the system libcrypto).
I think the fix would be to get that runpath/rpath inside libssl and bin/openssl as well.
I'm not sure of the right way to do that with the OpenSSL build system though.
Steps to reproduce the behavior
On Linux:
I added
<= BUG
to the output to highlight the problematic lines.So we see
bin/openssl
links to system libssl and system libcrypto, when it should link those inside the openssl prefix.And also that the built libssl links to system libcrypto and not in-the-same-dir libcrypto.
Since the system openssl in this case is 3.1.4 it results in relatively clear errors, but if they were closer it could maybe crash or so.
Luckily this doesn't seem to affect the Ruby openssl extension, which links correctly to the correct libssl and libcrypto:
But that still seems brittle because I'm not sure it's guaranteed the libcrypto dependency there always wins over the dependency declared in libssl. Having them with different values certainly seems bad.
I also checked with
ruby -ropen-uri -e 'puts URI.send(:open, %{https://rubygems.org/}) { |f| f.read(1024) }; sleep'
andlsof
and that looks fine, only the correct ibssl/libcrypto are loaded. But maybe by "chance".I think it would be nice to fix this so the built openssl has correct library dependencies and we don't run the risk of these conflicting dependencies to stop working at some point.
I noticed this with OpenSSL 3.4 but I think it happens with older versions as well like 3.0.
FWIW this is the patch I used because I wanted to check against OpenSSL 3.4 specifically (for oracle/truffleruby#3724):
The text was updated successfully, but these errors were encountered: