diff --git a/infra/Dockerfile.server b/infra/Dockerfile.server index 236ab0b..4f71b73 100644 --- a/infra/Dockerfile.server +++ b/infra/Dockerfile.server @@ -8,8 +8,10 @@ ARG TARGETPLATFORM ARG TARGETARCH ARG TARGETVARIANT -# Install cross-compilation toolchains only when actually cross-compiling. -RUN apt-get update && apt-get install -y pkg-config && \ +# Install build tools. gcc is always needed: cc-rs (used by ring/aes-gcm deps) +# calls the native compiler even on native builds, and rust:slim doesn't +# include it. Cross-compilers are added only when actually cross-compiling. +RUN apt-get update && apt-get install -y gcc pkg-config && \ if [ "${BUILDPLATFORM}" != "${TARGETPLATFORM}" ]; then \ case "${TARGETARCH}:${TARGETVARIANT}" in \ "arm64:") apt-get install -y gcc-aarch64-linux-gnu ;; \ @@ -29,8 +31,13 @@ RUN case "${TARGETARCH}:${TARGETVARIANT}" in \ esac > /rust_target && \ rustup target add "$(cat /rust_target)" -# Tell Cargo which cross-linker to use (ignored on native builds). +# Tell Cargo which linker to use for each target. +# x86_64 native: use plain gcc (cc-rs would otherwise look for +# "x86_64-linux-gnu-gcc" which is the *cross* toolchain, not installed here). RUN mkdir -p /root/.cargo && printf '\ +[target.x86_64-unknown-linux-gnu]\n\ +linker = "gcc"\n\ +\n\ [target.aarch64-unknown-linux-gnu]\n\ linker = "aarch64-linux-gnu-gcc"\n\ \n\