From 97545c12fe2cc232e65dbd522eea34d53252fa95 Mon Sep 17 00:00:00 2001 From: Chen-Wei Sun Date: Sat, 31 Oct 2026 17:44:14 +0800 Subject: [PATCH] fix(docker): let the cross linker find libgit2's OpenSSL deps Since #9288 the server binary links libgit2 directly. When the image is cross-built (amd64 runner, arm64 target), ld must resolve libgit2's own dependencies (libssl, libcrypto) but only searches the build host's paths, so the link fails with undefined OPENSSL_3.0.0 symbols. Point ld at the target rootfs with -rpath-link. It only affects link time; nothing is embedded in the binary. --- backend/Dockerfile | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/backend/Dockerfile b/backend/Dockerfile index 2c31a3d53fc..877a1ac7b88 100644 --- a/backend/Dockerfile +++ b/backend/Dockerfile @@ -97,11 +97,13 @@ RUN --mount=type=cache,target=/root/.cache/go-build \ if [ "$TARGETPLATFORM" = "linux/arm64" ] ; then \ ln -s /usr/local/deps/aarch64 /usr/local/deps/target && \ export CC=aarch64-linux-gnu-gcc && \ - export GOARCH=arm64 ; \ + export GOARCH=arm64 && \ + export CGO_LDFLAGS="-Wl,-rpath-link,/rootfs-arm64/usr/lib/aarch64-linux-gnu -Wl,-rpath-link,/rootfs-arm64/lib/aarch64-linux-gnu" ; \ else \ ln -s /usr/local/deps/x86_64 /usr/local/deps/target && \ export CC=x86_64-linux-gnu-gcc && \ - export GOARCH=amd64 ; \ + export GOARCH=amd64 && \ + export CGO_LDFLAGS="-Wl,-rpath-link,/rootfs-amd64/usr/lib/x86_64-linux-gnu -Wl,-rpath-link,/rootfs-amd64/lib/x86_64-linux-gnu" ; \ fi && \ export PKG_CONFIG_PATH=/usr/local/deps/target/lib/pkgconfig && \ export CGO_ENABLED=1 &&\