Skip to content

Commit 17f2470

Browse files
committed
Add extra static flags to libpq
1 parent 13f4e00 commit 17f2470

1 file changed

Lines changed: 14 additions & 7 deletions

File tree

Dockerfile

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ ENV SSL_VER="1.1.1w" \
6262
PKG_CONFIG_PATH=/usr/local/lib/pkgconfig \
6363
LD_LIBRARY_PATH=$PREFIX
6464

65-
ENV RUSTFLAGS="-C target-feature=+crt-static -L/musl/lib"
65+
ENV RUSTFLAGS="-C target-feature=+crt-static -L/musl/lib -C link-args=-lssl -lcrypto -lpq -static"
6666

6767
# Install a more recent release of protoc (protobuf-compiler in jammy is 4 years old and misses some features)
6868
RUN cd /tmp && \
@@ -106,12 +106,19 @@ RUN curl -sSL https://www.openssl.org/source/openssl-$SSL_VER.tar.gz | tar xz &&
106106
# Build libpq
107107
RUN curl -sSL https://ftp.postgresql.org/pub/source/v$PQ_VER/postgresql-$PQ_VER.tar.gz | tar xz && \
108108
cd postgresql-$PQ_VER && \
109-
CC="musl-gcc -fPIE -pie" LDFLAGS="-L$PREFIX/lib -static" CPPFLAGS="-I$PREFIX/include" ./configure \
110-
--without-readline \
111-
--with-openssl \
112-
--prefix=$PREFIX --host=x86_64-unknown-linux-musl && \
113-
cd src/interfaces/libpq make -s -j$(nproc) all-static-lib && make -s install install-lib-static && \
114-
cd ../../bin/pg_config && make -j $(nproc) && make install && \
109+
CC="musl-gcc -fPIE -pie" \
110+
LDFLAGS="-L$PREFIX/lib -lssl -lcrypto -static" \
111+
CPPFLAGS="-I$PREFIX/include" \
112+
./configure \
113+
--without-readline \
114+
--with-openssl \
115+
--prefix=$PREFIX \
116+
--host=x86_64-unknown-linux-musl && \
117+
cd src/interfaces/libpq && \
118+
make -s -j$(nproc) all-static-lib && \
119+
make -s install install-lib-static && \
120+
cd ../../bin/pg_config && \
121+
make -j $(nproc) && make install && \
115122
cd .. && rm -rf postgresql-$PQ_VER
116123

117124
# SSL cert directories get overridden by --prefix and --openssldir

0 commit comments

Comments
 (0)