From d45030380d8e1f8eadcb9512e81cfc63885aa638 Mon Sep 17 00:00:00 2001 From: Tonis Tiigi Date: Sun, 27 Mar 2022 16:52:53 -0700 Subject: [PATCH] Dockerfile: prefer ld for cross-compiling arm64 in bullseye Signed-off-by: Tonis Tiigi --- Dockerfile | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index a172ff685c9b..d588bbcfe98a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -55,6 +55,8 @@ ARG VERSION # PACKAGER_NAME sets the company that produced the windows binary ARG PACKAGER_NAME COPY --from=goversioninfo /out/goversioninfo /usr/bin/goversioninfo +# in bullseye arm64 target does not link with lld so configure it to use ld instead +RUN [ ! -f /etc/alpine-release ] && xx-info is-cross && [ "$(xx-info arch)" = "arm64" ] && XX_CC_PREFER_LINKER=ld xx-clang --setup-target-triple || true RUN --mount=type=bind,target=.,ro \ --mount=type=cache,target=/root/.cache \ --mount=from=dockercore/golang-cross:xx-sdk-extras,target=/xx-sdk,src=/xx-sdk \ @@ -69,9 +71,9 @@ FROM build-${BASE_VARIANT} AS test COPY --from=gotestsum /out/gotestsum /usr/bin/gotestsum ENV GO111MODULE=auto RUN --mount=type=bind,target=.,rw \ - --mount=type=cache,target=/root/.cache \ - --mount=type=cache,target=/go/pkg/mod \ - gotestsum -- -coverprofile=/tmp/coverage.txt $(go list ./... | grep -vE '/vendor/|/e2e/') + --mount=type=cache,target=/root/.cache \ + --mount=type=cache,target=/go/pkg/mod \ + gotestsum -- -coverprofile=/tmp/coverage.txt $(go list ./... | grep -vE '/vendor/|/e2e/') FROM scratch AS test-coverage COPY --from=test /tmp/coverage.txt /coverage.txt