🐛 Fix arm64 build: serialise Go compilation to prevent QEMU segfault 🐛

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
This commit is contained in:
2026-05-31 18:31:58 -04:00
parent 4a5c802368
commit 5160ac7e61
+4
View File
@@ -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"