Skip to content

Commit df0ec8a

Browse files
authored
Merge pull request #366 from infosiftr/rpath
Ditch both LD_LIBRARY_PATH and /etc/ld.so.conf in favor of rpath
2 parents 47deb27 + a5f3388 commit df0ec8a

File tree

8 files changed

+60
-32
lines changed

8 files changed

+60
-32
lines changed

3.7-rc/alpine/Dockerfile

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,6 @@ ARG PGP_KEYSERVER=ha.pool.sks-keyservers.net
1515
# run the build with a different PGP_KEYSERVER, e.g. docker build --tag rabbitmq:3.7 --build-arg PGP_KEYSERVER=pgpkeys.eu 3.7/ubuntu
1616
# For context, see https://github.com/docker-library/official-images/issues/4252
1717

18-
# avoid conflicts between our OpenSSL's "libssl.so" and Alpine's by making sure /usr/local/lib is searched first
19-
ENV LD_LIBRARY_PATH /usr/local/lib
20-
2118
# Using the latest OpenSSL LTS release, with support until September 2023 - https://www.openssl.org/source/
2219
ENV OPENSSL_VERSION 1.1.1c
2320
ENV OPENSSL_SOURCE_SHA256="f6fb3079ad15076154eda9413fed42877d668e7069d9b87396d0804fdb3f4c90"
@@ -78,7 +75,11 @@ RUN set -eux; \
7875
RELEASE="4.x.y-z" \
7976
SYSTEM='Linux' \
8077
BUILD='???' \
81-
./config --openssldir="$OPENSSL_CONFIG_DIR"; \
78+
./config \
79+
--openssldir="$OPENSSL_CONFIG_DIR" \
80+
# add -rpath to avoid conflicts between our OpenSSL's "libssl.so" and the libssl package by making sure /usr/local/lib is searched first (but only for Erlang/OpenSSL to avoid issues with other tools using libssl; https://github.com/docker-library/rabbitmq/issues/364)
81+
-Wl,-rpath=/usr/local/lib \
82+
; \
8283
# Compile, install OpenSSL, verify that the command-line works & development headers are present
8384
make -j "$(getconf _NPROCESSORS_ONLN)"; \
8485
make install_sw install_ssldirs; \
@@ -106,6 +107,8 @@ RUN set -eux; \
106107
export ERL_TOP="$OTP_PATH"; \
107108
./otp_build autoconf; \
108109
export CFLAGS='-g -O2'; \
110+
# add -rpath to avoid conflicts between our OpenSSL's "libssl.so" and the libssl package by making sure /usr/local/lib is searched first (but only for Erlang/OpenSSL to avoid issues with other tools using libssl; https://github.com/docker-library/rabbitmq/issues/364)
111+
export CFLAGS="$CFLAGS -Wl,-rpath=/usr/local/lib"; \
109112
hostArch="$(dpkg-architecture --query DEB_HOST_GNU_TYPE)"; \
110113
buildArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \
111114
dpkgArch="$(dpkg --print-architecture)"; dpkgArch="${dpkgArch##*-}"; \

3.7-rc/ubuntu/Dockerfile

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,15 +79,17 @@ RUN set -eux; \
7979
RELEASE="4.x.y-z" \
8080
SYSTEM='Linux' \
8181
BUILD='???' \
82-
./config --openssldir="$OPENSSL_CONFIG_DIR" --libdir="lib/$debMultiarch"; \
82+
./config \
83+
--openssldir="$OPENSSL_CONFIG_DIR" \
84+
--libdir="lib/$debMultiarch" \
85+
# add -rpath to avoid conflicts between our OpenSSL's "libssl.so" and the libssl package by making sure /usr/local/lib is searched first (but only for Erlang/OpenSSL to avoid issues with other tools using libssl; https://github.com/docker-library/rabbitmq/issues/364)
86+
-Wl,-rpath=/usr/local/lib \
87+
; \
8388
# Compile, install OpenSSL, verify that the command-line works & development headers are present
8489
make -j "$(getconf _NPROCESSORS_ONLN)"; \
8590
make install_sw install_ssldirs; \
8691
cd ..; \
8792
rm -rf "$OPENSSL_PATH"*; \
88-
# this is included in "/etc/ld.so.conf.d/libc.conf", but on arm64, it gets overshadowed by "/etc/ld.so.conf.d/aarch64-linux-gnu.conf" (vs "/etc/ld.so.conf.d/x86_64-linux-gnu.conf") so the precedence isn't correct -- we install our own file to overcome that and ensure any .so files in /usr/local/lib (especially OpenSSL's libssl.so) are preferred appropriately regardless of the target architecture
89-
# see https://bugs.debian.org/685706
90-
echo '/usr/local/lib' > /etc/ld.so.conf.d/000-openssl-libc.conf; \
9193
ldconfig; \
9294
# use Debian's CA certificates
9395
rmdir "$OPENSSL_CONFIG_DIR/certs" "$OPENSSL_CONFIG_DIR/private"; \
@@ -111,6 +113,8 @@ RUN set -eux; \
111113
export ERL_TOP="$OTP_PATH"; \
112114
./otp_build autoconf; \
113115
CFLAGS="$(dpkg-buildflags --get CFLAGS)"; export CFLAGS; \
116+
# add -rpath to avoid conflicts between our OpenSSL's "libssl.so" and the libssl package by making sure /usr/local/lib is searched first (but only for Erlang/OpenSSL to avoid issues with other tools using libssl; https://github.com/docker-library/rabbitmq/issues/364)
117+
export CFLAGS="$CFLAGS -Wl,-rpath=/usr/local/lib"; \
114118
hostArch="$(dpkg-architecture --query DEB_HOST_GNU_TYPE)"; \
115119
buildArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \
116120
dpkgArch="$(dpkg --print-architecture)"; dpkgArch="${dpkgArch##*-}"; \

3.7/alpine/Dockerfile

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,6 @@ ARG PGP_KEYSERVER=ha.pool.sks-keyservers.net
1515
# run the build with a different PGP_KEYSERVER, e.g. docker build --tag rabbitmq:3.7 --build-arg PGP_KEYSERVER=pgpkeys.eu 3.7/ubuntu
1616
# For context, see https://github.com/docker-library/official-images/issues/4252
1717

18-
# avoid conflicts between our OpenSSL's "libssl.so" and Alpine's by making sure /usr/local/lib is searched first
19-
ENV LD_LIBRARY_PATH /usr/local/lib
20-
2118
# Using the latest OpenSSL LTS release, with support until September 2023 - https://www.openssl.org/source/
2219
ENV OPENSSL_VERSION 1.1.1c
2320
ENV OPENSSL_SOURCE_SHA256="f6fb3079ad15076154eda9413fed42877d668e7069d9b87396d0804fdb3f4c90"
@@ -78,7 +75,11 @@ RUN set -eux; \
7875
RELEASE="4.x.y-z" \
7976
SYSTEM='Linux' \
8077
BUILD='???' \
81-
./config --openssldir="$OPENSSL_CONFIG_DIR"; \
78+
./config \
79+
--openssldir="$OPENSSL_CONFIG_DIR" \
80+
# add -rpath to avoid conflicts between our OpenSSL's "libssl.so" and the libssl package by making sure /usr/local/lib is searched first (but only for Erlang/OpenSSL to avoid issues with other tools using libssl; https://github.com/docker-library/rabbitmq/issues/364)
81+
-Wl,-rpath=/usr/local/lib \
82+
; \
8283
# Compile, install OpenSSL, verify that the command-line works & development headers are present
8384
make -j "$(getconf _NPROCESSORS_ONLN)"; \
8485
make install_sw install_ssldirs; \
@@ -106,6 +107,8 @@ RUN set -eux; \
106107
export ERL_TOP="$OTP_PATH"; \
107108
./otp_build autoconf; \
108109
export CFLAGS='-g -O2'; \
110+
# add -rpath to avoid conflicts between our OpenSSL's "libssl.so" and the libssl package by making sure /usr/local/lib is searched first (but only for Erlang/OpenSSL to avoid issues with other tools using libssl; https://github.com/docker-library/rabbitmq/issues/364)
111+
export CFLAGS="$CFLAGS -Wl,-rpath=/usr/local/lib"; \
109112
hostArch="$(dpkg-architecture --query DEB_HOST_GNU_TYPE)"; \
110113
buildArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \
111114
dpkgArch="$(dpkg --print-architecture)"; dpkgArch="${dpkgArch##*-}"; \

3.7/ubuntu/Dockerfile

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,15 +79,17 @@ RUN set -eux; \
7979
RELEASE="4.x.y-z" \
8080
SYSTEM='Linux' \
8181
BUILD='???' \
82-
./config --openssldir="$OPENSSL_CONFIG_DIR" --libdir="lib/$debMultiarch"; \
82+
./config \
83+
--openssldir="$OPENSSL_CONFIG_DIR" \
84+
--libdir="lib/$debMultiarch" \
85+
# add -rpath to avoid conflicts between our OpenSSL's "libssl.so" and the libssl package by making sure /usr/local/lib is searched first (but only for Erlang/OpenSSL to avoid issues with other tools using libssl; https://github.com/docker-library/rabbitmq/issues/364)
86+
-Wl,-rpath=/usr/local/lib \
87+
; \
8388
# Compile, install OpenSSL, verify that the command-line works & development headers are present
8489
make -j "$(getconf _NPROCESSORS_ONLN)"; \
8590
make install_sw install_ssldirs; \
8691
cd ..; \
8792
rm -rf "$OPENSSL_PATH"*; \
88-
# this is included in "/etc/ld.so.conf.d/libc.conf", but on arm64, it gets overshadowed by "/etc/ld.so.conf.d/aarch64-linux-gnu.conf" (vs "/etc/ld.so.conf.d/x86_64-linux-gnu.conf") so the precedence isn't correct -- we install our own file to overcome that and ensure any .so files in /usr/local/lib (especially OpenSSL's libssl.so) are preferred appropriately regardless of the target architecture
89-
# see https://bugs.debian.org/685706
90-
echo '/usr/local/lib' > /etc/ld.so.conf.d/000-openssl-libc.conf; \
9193
ldconfig; \
9294
# use Debian's CA certificates
9395
rmdir "$OPENSSL_CONFIG_DIR/certs" "$OPENSSL_CONFIG_DIR/private"; \
@@ -111,6 +113,8 @@ RUN set -eux; \
111113
export ERL_TOP="$OTP_PATH"; \
112114
./otp_build autoconf; \
113115
CFLAGS="$(dpkg-buildflags --get CFLAGS)"; export CFLAGS; \
116+
# add -rpath to avoid conflicts between our OpenSSL's "libssl.so" and the libssl package by making sure /usr/local/lib is searched first (but only for Erlang/OpenSSL to avoid issues with other tools using libssl; https://github.com/docker-library/rabbitmq/issues/364)
117+
export CFLAGS="$CFLAGS -Wl,-rpath=/usr/local/lib"; \
114118
hostArch="$(dpkg-architecture --query DEB_HOST_GNU_TYPE)"; \
115119
buildArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \
116120
dpkgArch="$(dpkg --print-architecture)"; dpkgArch="${dpkgArch##*-}"; \

3.8-rc/alpine/Dockerfile

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,6 @@ ARG PGP_KEYSERVER=ha.pool.sks-keyservers.net
1515
# run the build with a different PGP_KEYSERVER, e.g. docker build --tag rabbitmq:3.7 --build-arg PGP_KEYSERVER=pgpkeys.eu 3.7/ubuntu
1616
# For context, see https://github.com/docker-library/official-images/issues/4252
1717

18-
# avoid conflicts between our OpenSSL's "libssl.so" and Alpine's by making sure /usr/local/lib is searched first
19-
ENV LD_LIBRARY_PATH /usr/local/lib
20-
2118
# Using the latest OpenSSL LTS release, with support until September 2023 - https://www.openssl.org/source/
2219
ENV OPENSSL_VERSION 1.1.1c
2320
ENV OPENSSL_SOURCE_SHA256="f6fb3079ad15076154eda9413fed42877d668e7069d9b87396d0804fdb3f4c90"
@@ -78,7 +75,11 @@ RUN set -eux; \
7875
RELEASE="4.x.y-z" \
7976
SYSTEM='Linux' \
8077
BUILD='???' \
81-
./config --openssldir="$OPENSSL_CONFIG_DIR"; \
78+
./config \
79+
--openssldir="$OPENSSL_CONFIG_DIR" \
80+
# add -rpath to avoid conflicts between our OpenSSL's "libssl.so" and the libssl package by making sure /usr/local/lib is searched first (but only for Erlang/OpenSSL to avoid issues with other tools using libssl; https://github.com/docker-library/rabbitmq/issues/364)
81+
-Wl,-rpath=/usr/local/lib \
82+
; \
8283
# Compile, install OpenSSL, verify that the command-line works & development headers are present
8384
make -j "$(getconf _NPROCESSORS_ONLN)"; \
8485
make install_sw install_ssldirs; \
@@ -106,6 +107,8 @@ RUN set -eux; \
106107
export ERL_TOP="$OTP_PATH"; \
107108
./otp_build autoconf; \
108109
export CFLAGS='-g -O2'; \
110+
# add -rpath to avoid conflicts between our OpenSSL's "libssl.so" and the libssl package by making sure /usr/local/lib is searched first (but only for Erlang/OpenSSL to avoid issues with other tools using libssl; https://github.com/docker-library/rabbitmq/issues/364)
111+
export CFLAGS="$CFLAGS -Wl,-rpath=/usr/local/lib"; \
109112
hostArch="$(dpkg-architecture --query DEB_HOST_GNU_TYPE)"; \
110113
buildArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \
111114
dpkgArch="$(dpkg --print-architecture)"; dpkgArch="${dpkgArch##*-}"; \

3.8-rc/ubuntu/Dockerfile

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,15 +79,17 @@ RUN set -eux; \
7979
RELEASE="4.x.y-z" \
8080
SYSTEM='Linux' \
8181
BUILD='???' \
82-
./config --openssldir="$OPENSSL_CONFIG_DIR" --libdir="lib/$debMultiarch"; \
82+
./config \
83+
--openssldir="$OPENSSL_CONFIG_DIR" \
84+
--libdir="lib/$debMultiarch" \
85+
# add -rpath to avoid conflicts between our OpenSSL's "libssl.so" and the libssl package by making sure /usr/local/lib is searched first (but only for Erlang/OpenSSL to avoid issues with other tools using libssl; https://github.com/docker-library/rabbitmq/issues/364)
86+
-Wl,-rpath=/usr/local/lib \
87+
; \
8388
# Compile, install OpenSSL, verify that the command-line works & development headers are present
8489
make -j "$(getconf _NPROCESSORS_ONLN)"; \
8590
make install_sw install_ssldirs; \
8691
cd ..; \
8792
rm -rf "$OPENSSL_PATH"*; \
88-
# this is included in "/etc/ld.so.conf.d/libc.conf", but on arm64, it gets overshadowed by "/etc/ld.so.conf.d/aarch64-linux-gnu.conf" (vs "/etc/ld.so.conf.d/x86_64-linux-gnu.conf") so the precedence isn't correct -- we install our own file to overcome that and ensure any .so files in /usr/local/lib (especially OpenSSL's libssl.so) are preferred appropriately regardless of the target architecture
89-
# see https://bugs.debian.org/685706
90-
echo '/usr/local/lib' > /etc/ld.so.conf.d/000-openssl-libc.conf; \
9193
ldconfig; \
9294
# use Debian's CA certificates
9395
rmdir "$OPENSSL_CONFIG_DIR/certs" "$OPENSSL_CONFIG_DIR/private"; \
@@ -111,6 +113,8 @@ RUN set -eux; \
111113
export ERL_TOP="$OTP_PATH"; \
112114
./otp_build autoconf; \
113115
CFLAGS="$(dpkg-buildflags --get CFLAGS)"; export CFLAGS; \
116+
# add -rpath to avoid conflicts between our OpenSSL's "libssl.so" and the libssl package by making sure /usr/local/lib is searched first (but only for Erlang/OpenSSL to avoid issues with other tools using libssl; https://github.com/docker-library/rabbitmq/issues/364)
117+
export CFLAGS="$CFLAGS -Wl,-rpath=/usr/local/lib"; \
114118
hostArch="$(dpkg-architecture --query DEB_HOST_GNU_TYPE)"; \
115119
buildArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \
116120
dpkgArch="$(dpkg --print-architecture)"; dpkgArch="${dpkgArch##*-}"; \

Dockerfile-alpine.template

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,6 @@ ARG PGP_KEYSERVER=ha.pool.sks-keyservers.net
1515
# run the build with a different PGP_KEYSERVER, e.g. docker build --tag rabbitmq:3.7 --build-arg PGP_KEYSERVER=pgpkeys.eu 3.7/ubuntu
1616
# For context, see https://github.com/docker-library/official-images/issues/4252
1717

18-
# avoid conflicts between our OpenSSL's "libssl.so" and Alpine's by making sure /usr/local/lib is searched first
19-
ENV LD_LIBRARY_PATH /usr/local/lib
20-
2118
# Using the latest OpenSSL LTS release, with support until September 2023 - https://www.openssl.org/source/
2219
ENV OPENSSL_VERSION %%OPENSSL_VERSION%%
2320
ENV OPENSSL_SOURCE_SHA256="%%OPENSSL_SOURCE_SHA256%%"
@@ -78,7 +75,11 @@ RUN set -eux; \
7875
RELEASE="4.x.y-z" \
7976
SYSTEM='Linux' \
8077
BUILD='???' \
81-
./config --openssldir="$OPENSSL_CONFIG_DIR"; \
78+
./config \
79+
--openssldir="$OPENSSL_CONFIG_DIR" \
80+
# add -rpath to avoid conflicts between our OpenSSL's "libssl.so" and the libssl package by making sure /usr/local/lib is searched first (but only for Erlang/OpenSSL to avoid issues with other tools using libssl; https://github.com/docker-library/rabbitmq/issues/364)
81+
-Wl,-rpath=/usr/local/lib \
82+
; \
8283
# Compile, install OpenSSL, verify that the command-line works & development headers are present
8384
make -j "$(getconf _NPROCESSORS_ONLN)"; \
8485
make install_sw install_ssldirs; \
@@ -106,6 +107,8 @@ RUN set -eux; \
106107
export ERL_TOP="$OTP_PATH"; \
107108
./otp_build autoconf; \
108109
export CFLAGS='-g -O2'; \
110+
# add -rpath to avoid conflicts between our OpenSSL's "libssl.so" and the libssl package by making sure /usr/local/lib is searched first (but only for Erlang/OpenSSL to avoid issues with other tools using libssl; https://github.com/docker-library/rabbitmq/issues/364)
111+
export CFLAGS="$CFLAGS -Wl,-rpath=/usr/local/lib"; \
109112
hostArch="$(dpkg-architecture --query DEB_HOST_GNU_TYPE)"; \
110113
buildArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \
111114
dpkgArch="$(dpkg --print-architecture)"; dpkgArch="${dpkgArch##*-}"; \

Dockerfile-ubuntu.template

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,15 +79,17 @@ RUN set -eux; \
7979
RELEASE="4.x.y-z" \
8080
SYSTEM='Linux' \
8181
BUILD='???' \
82-
./config --openssldir="$OPENSSL_CONFIG_DIR" --libdir="lib/$debMultiarch"; \
82+
./config \
83+
--openssldir="$OPENSSL_CONFIG_DIR" \
84+
--libdir="lib/$debMultiarch" \
85+
# add -rpath to avoid conflicts between our OpenSSL's "libssl.so" and the libssl package by making sure /usr/local/lib is searched first (but only for Erlang/OpenSSL to avoid issues with other tools using libssl; https://github.com/docker-library/rabbitmq/issues/364)
86+
-Wl,-rpath=/usr/local/lib \
87+
; \
8388
# Compile, install OpenSSL, verify that the command-line works & development headers are present
8489
make -j "$(getconf _NPROCESSORS_ONLN)"; \
8590
make install_sw install_ssldirs; \
8691
cd ..; \
8792
rm -rf "$OPENSSL_PATH"*; \
88-
# this is included in "/etc/ld.so.conf.d/libc.conf", but on arm64, it gets overshadowed by "/etc/ld.so.conf.d/aarch64-linux-gnu.conf" (vs "/etc/ld.so.conf.d/x86_64-linux-gnu.conf") so the precedence isn't correct -- we install our own file to overcome that and ensure any .so files in /usr/local/lib (especially OpenSSL's libssl.so) are preferred appropriately regardless of the target architecture
89-
# see https://bugs.debian.org/685706
90-
echo '/usr/local/lib' > /etc/ld.so.conf.d/000-openssl-libc.conf; \
9193
ldconfig; \
9294
# use Debian's CA certificates
9395
rmdir "$OPENSSL_CONFIG_DIR/certs" "$OPENSSL_CONFIG_DIR/private"; \
@@ -111,6 +113,8 @@ RUN set -eux; \
111113
export ERL_TOP="$OTP_PATH"; \
112114
./otp_build autoconf; \
113115
CFLAGS="$(dpkg-buildflags --get CFLAGS)"; export CFLAGS; \
116+
# add -rpath to avoid conflicts between our OpenSSL's "libssl.so" and the libssl package by making sure /usr/local/lib is searched first (but only for Erlang/OpenSSL to avoid issues with other tools using libssl; https://github.com/docker-library/rabbitmq/issues/364)
117+
export CFLAGS="$CFLAGS -Wl,-rpath=/usr/local/lib"; \
114118
hostArch="$(dpkg-architecture --query DEB_HOST_GNU_TYPE)"; \
115119
buildArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \
116120
dpkgArch="$(dpkg --print-architecture)"; dpkgArch="${dpkgArch##*-}"; \

0 commit comments

Comments
 (0)