Skip to content

Commit 068c404

Browse files
authored
Fix library lookup path in the vendored OpenSSL (rbenv#2493)
* Fix library lookup path in the vendored OpenSSL When a vendored OpenSSL is needed for compiling Ruby, that OpenSSL installation ends up with its `bin/openssl` executable broken due to not finding "libssl.so" and "libcrypto.so" in the global load path for libraries. This doesn't seem to negatively affect the Ruby "openssl" extension, but is a broken OpenSSL install nevertheless. This change causes the `bin/openssl` executable and related shared libraries to be built with an "RPATH" pointing to the "lib" directory of the vendored OpenSSL. * fix test
1 parent 47c9d90 commit 068c404

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

bin/ruby-build

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1215,7 +1215,7 @@ build_package_openssl() {
12151215
[[ "$1" != openssl-1.0.* ]] || nokerberos=1
12161216

12171217
# Compile a shared lib with zlib dynamically linked.
1218-
package_option openssl configure --openssldir="$OPENSSLDIR" --libdir="lib" zlib-dynamic no-ssl3 shared ${nokerberos:+no-ssl2 no-krb5}
1218+
package_option openssl configure --openssldir="$OPENSSLDIR" --libdir="lib" -Wl,-rpath="$OPENSSL_PREFIX_PATH/lib" zlib-dynamic no-ssl3 shared ${nokerberos:+no-ssl2 no-krb5}
12191219

12201220
# Skip building OpenSSL docs, which is slow.
12211221
local make_target="install_sw install_ssldirs"

test/build.bats

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -397,7 +397,7 @@ DEF
397397
unstub make
398398

399399
assert_build_log <<OUT
400-
openssl-1.1.1w: [--prefix=${INSTALL_ROOT}/openssl,--openssldir=${INSTALL_ROOT}/openssl/ssl,--libdir=lib,zlib-dynamic,no-ssl3,shared]
400+
openssl-1.1.1w: [--prefix=${INSTALL_ROOT}/openssl,--openssldir=${INSTALL_ROOT}/openssl/ssl,--libdir=lib,-Wl,-rpath=${INSTALL_ROOT}/openssl/lib,zlib-dynamic,no-ssl3,shared]
401401
make -j 2
402402
make install_sw install_ssldirs
403403
ruby-3.2.0: [--prefix=$INSTALL_ROOT,--with-openssl-dir=$INSTALL_ROOT/openssl,--with-ext=openssl,psych,+] PKG_CONFIG_PATH=${TMP}/install/openssl/lib/pkgconfig

0 commit comments

Comments
 (0)