Skip to content

Commit c222f0a

Browse files
authored
Merge pull request #310 from infosiftr/ldconfig-preference
Fix shared library loading preference on non-x86 architectures (especially those like aarch64 which sort lexicographically ahead of "libc.conf")
2 parents 0576eab + c3af691 commit c222f0a

File tree

10 files changed

+69
-0
lines changed

10 files changed

+69
-0
lines changed

.travis.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,17 @@ services: docker
33

44
env:
55
- VERSION=3.8-rc VARIANT=ubuntu
6+
- VERSION=3.8-rc VARIANT=ubuntu ARCH=i386
67
- VERSION=3.8-rc VARIANT=alpine
8+
- VERSION=3.8-rc VARIANT=alpine ARCH=i386
79
- VERSION=3.7-rc VARIANT=ubuntu
10+
- VERSION=3.7-rc VARIANT=ubuntu ARCH=i386
811
- VERSION=3.7-rc VARIANT=alpine
12+
- VERSION=3.7-rc VARIANT=alpine ARCH=i386
913
- VERSION=3.7 VARIANT=ubuntu
14+
- VERSION=3.7 VARIANT=ubuntu ARCH=i386
1015
- VERSION=3.7 VARIANT=alpine
16+
- VERSION=3.7 VARIANT=alpine ARCH=i386
1117

1218
install:
1319
- git clone https://github.com/docker-library/official-images.git ~/official-images
@@ -17,6 +23,16 @@ before_script:
1723
- wget -qO- 'https://github.com/tianon/pgp-happy-eyeballs/raw/master/hack-my-builds.sh' | bash
1824
- cd "$VERSION/$VARIANT"
1925
- image="$(awk 'toupper($1) == "FROM" { print $2; exit }' management/Dockerfile)"
26+
- |
27+
(
28+
set -Eeuo pipefail
29+
set -x
30+
if [ -n "${ARCH:-}" ]; then
31+
from="$(awk '$1 == toupper("FROM") { print $2 }' Dockerfile)"
32+
docker pull "$ARCH/$from"
33+
docker tag "$ARCH/$from" "$from"
34+
fi
35+
)
2036
2137
script:
2238
- |

3.7-rc/alpine/Dockerfile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,11 @@ RUN set -eux; \
6767
\
6868
# Configure OpenSSL for compilation
6969
cd "$OPENSSL_PATH"; \
70+
# OpenSSL's "config" script uses a lot of "uname"-based target detection...
71+
MACHINE="$(dpkg-architecture --query DEB_BUILD_GNU_CPU)" \
72+
RELEASE="4.x.y-z" \
73+
SYSTEM='Linux' \
74+
BUILD='???' \
7075
./config --openssldir="$OPENSSL_CONFIG_DIR"; \
7176
# Compile, install OpenSSL, verify that the command-line works & development headers are present
7277
make -j "$(getconf _NPROCESSORS_ONLN)"; \

3.7-rc/ubuntu/Dockerfile

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,12 +74,20 @@ RUN set -eux; \
7474
\
7575
# Configure OpenSSL for compilation
7676
cd "$OPENSSL_PATH"; \
77+
# OpenSSL's "config" script uses a lot of "uname"-based target detection...
78+
MACHINE="$(dpkg-architecture --query DEB_BUILD_GNU_CPU)" \
79+
RELEASE="4.x.y-z" \
80+
SYSTEM='Linux' \
81+
BUILD='???' \
7782
./config --openssldir="$OPENSSL_CONFIG_DIR"; \
7883
# Compile, install OpenSSL, verify that the command-line works & development headers are present
7984
make -j "$(getconf _NPROCESSORS_ONLN)"; \
8085
make install_sw install_ssldirs; \
8186
cd ..; \
8287
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; \
8391
ldconfig; \
8492
# use Debian's CA certificates
8593
rmdir "$OPENSSL_CONFIG_DIR/certs" "$OPENSSL_CONFIG_DIR/private"; \

3.7/alpine/Dockerfile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,11 @@ RUN set -eux; \
6767
\
6868
# Configure OpenSSL for compilation
6969
cd "$OPENSSL_PATH"; \
70+
# OpenSSL's "config" script uses a lot of "uname"-based target detection...
71+
MACHINE="$(dpkg-architecture --query DEB_BUILD_GNU_CPU)" \
72+
RELEASE="4.x.y-z" \
73+
SYSTEM='Linux' \
74+
BUILD='???' \
7075
./config --openssldir="$OPENSSL_CONFIG_DIR"; \
7176
# Compile, install OpenSSL, verify that the command-line works & development headers are present
7277
make -j "$(getconf _NPROCESSORS_ONLN)"; \

3.7/ubuntu/Dockerfile

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,12 +74,20 @@ RUN set -eux; \
7474
\
7575
# Configure OpenSSL for compilation
7676
cd "$OPENSSL_PATH"; \
77+
# OpenSSL's "config" script uses a lot of "uname"-based target detection...
78+
MACHINE="$(dpkg-architecture --query DEB_BUILD_GNU_CPU)" \
79+
RELEASE="4.x.y-z" \
80+
SYSTEM='Linux' \
81+
BUILD='???' \
7782
./config --openssldir="$OPENSSL_CONFIG_DIR"; \
7883
# Compile, install OpenSSL, verify that the command-line works & development headers are present
7984
make -j "$(getconf _NPROCESSORS_ONLN)"; \
8085
make install_sw install_ssldirs; \
8186
cd ..; \
8287
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; \
8391
ldconfig; \
8492
# use Debian's CA certificates
8593
rmdir "$OPENSSL_CONFIG_DIR/certs" "$OPENSSL_CONFIG_DIR/private"; \

3.8-rc/alpine/Dockerfile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,11 @@ RUN set -eux; \
6767
\
6868
# Configure OpenSSL for compilation
6969
cd "$OPENSSL_PATH"; \
70+
# OpenSSL's "config" script uses a lot of "uname"-based target detection...
71+
MACHINE="$(dpkg-architecture --query DEB_BUILD_GNU_CPU)" \
72+
RELEASE="4.x.y-z" \
73+
SYSTEM='Linux' \
74+
BUILD='???' \
7075
./config --openssldir="$OPENSSL_CONFIG_DIR"; \
7176
# Compile, install OpenSSL, verify that the command-line works & development headers are present
7277
make -j "$(getconf _NPROCESSORS_ONLN)"; \

3.8-rc/ubuntu/Dockerfile

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,12 +74,20 @@ RUN set -eux; \
7474
\
7575
# Configure OpenSSL for compilation
7676
cd "$OPENSSL_PATH"; \
77+
# OpenSSL's "config" script uses a lot of "uname"-based target detection...
78+
MACHINE="$(dpkg-architecture --query DEB_BUILD_GNU_CPU)" \
79+
RELEASE="4.x.y-z" \
80+
SYSTEM='Linux' \
81+
BUILD='???' \
7782
./config --openssldir="$OPENSSL_CONFIG_DIR"; \
7883
# Compile, install OpenSSL, verify that the command-line works & development headers are present
7984
make -j "$(getconf _NPROCESSORS_ONLN)"; \
8085
make install_sw install_ssldirs; \
8186
cd ..; \
8287
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; \
8391
ldconfig; \
8492
# use Debian's CA certificates
8593
rmdir "$OPENSSL_CONFIG_DIR/certs" "$OPENSSL_CONFIG_DIR/private"; \

Dockerfile-alpine.template

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,11 @@ RUN set -eux; \
6767
\
6868
# Configure OpenSSL for compilation
6969
cd "$OPENSSL_PATH"; \
70+
# OpenSSL's "config" script uses a lot of "uname"-based target detection...
71+
MACHINE="$(dpkg-architecture --query DEB_BUILD_GNU_CPU)" \
72+
RELEASE="4.x.y-z" \
73+
SYSTEM='Linux' \
74+
BUILD='???' \
7075
./config --openssldir="$OPENSSL_CONFIG_DIR"; \
7176
# Compile, install OpenSSL, verify that the command-line works & development headers are present
7277
make -j "$(getconf _NPROCESSORS_ONLN)"; \

Dockerfile-ubuntu.template

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,12 +74,20 @@ RUN set -eux; \
7474
\
7575
# Configure OpenSSL for compilation
7676
cd "$OPENSSL_PATH"; \
77+
# OpenSSL's "config" script uses a lot of "uname"-based target detection...
78+
MACHINE="$(dpkg-architecture --query DEB_BUILD_GNU_CPU)" \
79+
RELEASE="4.x.y-z" \
80+
SYSTEM='Linux' \
81+
BUILD='???' \
7782
./config --openssldir="$OPENSSL_CONFIG_DIR"; \
7883
# Compile, install OpenSSL, verify that the command-line works & development headers are present
7984
make -j "$(getconf _NPROCESSORS_ONLN)"; \
8085
make install_sw install_ssldirs; \
8186
cd ..; \
8287
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; \
8391
ldconfig; \
8492
# use Debian's CA certificates
8593
rmdir "$OPENSSL_CONFIG_DIR/certs" "$OPENSSL_CONFIG_DIR/private"; \

update.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ for version in "${versions[@]}"; do
116116
Dockerfile-management.template \
117117
> "$version/$variant/management/Dockerfile"
118118

119+
travisEnv='\n - VERSION='"$version"' VARIANT='"$variant ARCH=i386$travisEnv"
119120
travisEnv='\n - VERSION='"$version"' VARIANT='"$variant$travisEnv"
120121
done
121122
done

0 commit comments

Comments
 (0)