mirror of
https://github.com/dockersrc/go
synced 2026-06-24 14:01:08 -04:00
🐛 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:
@@ -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"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user