From 8323536e84bfdd5a2460654052f1abf910ddb92b Mon Sep 17 00:00:00 2001 From: WeebDataHoarder Date: Sat, 28 Jun 2025 10:44:08 +0200 Subject: [PATCH] build/docker: disable PIE buildmode under riscv64 due to https://github.com/golang/go/issues/64875 --- Dockerfile | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 3988671..a87f8a3 100644 --- a/Dockerfile +++ b/Dockerfile @@ -24,11 +24,16 @@ ENV CGO_ENABLED=0 ENV GOOS=${TARGETOS} ENV GOARCH=${TARGETARCH} ENV GOTOOLCHAIN=${GOTOOLCHAIN} +ENV BUILDMODE=pie -RUN go build -v \ +# riscv64 requires GCC for pie buildmode +# see https://github.com/golang/go/issues/64875 +RUN if [[ "$GOARCH" == "riscv64" ]]; then export BUILDMODE=exe; fi && \ + go build -v \ -pgo=auto \ - -trimpath -ldflags='-buildid= -bindnow' -buildmode pie \ + -trimpath -ldflags='-buildid= -bindnow' -buildmode $BUILDMODE \ -o "${GOBIN}/go-away" ./cmd/go-away + RUN test -e "${GOBIN}/go-away"