From 5160ac7e61e3c9f3c566243657207151155bb7e9 Mon Sep 17 00:00:00 2001 From: casjay Date: Sun, 31 May 2026 18:31:58 -0400 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Fix=20arm64=20build:=20serialise?= =?UTF-8?q?=20Go=20compilation=20to=20prevent=20QEMU=20segfault=20?= =?UTF-8?q?=F0=9F=90=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The arm64 build was failing with: github.com/caarlos0/go-version: .../linux_arm64/compile: signal: segmentation fault Under QEMU emulation, parallel Go package compilation creates memory pressure that causes the compiler to crash. Setting GOFLAGS=-p=1 on aarch64 serialises compilation, eliminating the segfault. amd64 builds are unaffected (no flag set on x86_64). - rootfs/root/docker/setup/05-custom.sh: detect aarch64 via uname -m and export GOFLAGS=-p=1 before all go install calls rootfs/root/docker/setup/05-custom.sh --- rootfs/root/docker/setup/05-custom.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/rootfs/root/docker/setup/05-custom.sh b/rootfs/root/docker/setup/05-custom.sh index f9c6bb8..197300c 100755 --- a/rootfs/root/docker/setup/05-custom.sh +++ b/rootfs/root/docker/setup/05-custom.sh @@ -73,6 +73,10 @@ export GOCACHE="${GOCACHE_BUILD}" export CGO_ENABLED="0" export GOTOOLCHAIN="auto" +# Under QEMU arm64 emulation the Go compiler can segfault when many packages +# compile in parallel due to memory pressure. Serialise compilation on arm64. +[ "$(uname -m)" = "aarch64" ] && export GOFLAGS="${GOFLAGS:+$GOFLAGS }-p=1" + # Ensure the GOPATH directory tree exists mkdir -p "${GOPATH_DIR}/pkg/mod" "${GOPATH_DIR}/cache" "${GOPATH_DIR}/bin"