Skip to content

cmd/compile/internal: asm hangs forever (12 hours) with pegged cpu in QEMU cross-compile #77690

Description

@xxxserxxx

Go version

go version go1.25.7 linux/arm64

Output of go env in your module/workspace:

AR='ar'
CC='cc'
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_ENABLED='1'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
CXX='c++'
GCCGO='gccgo'
GO111MODULE=''
GOARCH='arm64'
GOARM64='v8.0'
GOAUTH='netrc'
GOBIN=''
GOCACHE='/root/.cache/go-build'
GOCACHEPROG=''
GODEBUG=''
GOENV='/root/.config/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFIPS140='off'
GOFLAGS=''
GOGCCFLAGS='-fPIC -pthread -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/tmp/go-build4113777134=/tmp/go-build -gno-record-gcc-switches'
GOHOSTARCH='arm64'
GOHOSTOS='linux'
GOINSECURE=''
GOMOD='/workspace/go.mod'
GOMODCACHE='/root/go/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='linux'
GOPATH='/root/go'
GOPRIVATE=''
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/usr/lib/go'
GOSUMDB='sum.golang.org'
GOTELEMETRY='local'
GOTELEMETRYDIR='/root/.config/go/telemetry'
GOTMPDIR=''
GOTOOLCHAIN='local'
GOTOOLDIR='/usr/lib/go/pkg/tool/linux_arm64'
GOVCS=''
GOVERSION='go1.25.7'
GOWORK=''
PKG_CONFIG='pkg-config'

What did you do?

I'm trying to compile a small program using gioui for arm64 on an amd64 Arch Linux machine. The program compiles natively without issue.

Because of the X and Wayland dependencies, cross-compiling directly fails -- apparently during finding resources like headers -- so I am trying to cross compile in an LXC container via podman and qemu.

$ pacman -S qemu-user-static qemu-user-static-binfmt
$ sudo podman run --rm --privileged docker.io/multiarch/qemu-user-static --reset -p yes

And then I compile this project using the Containerfile in the project with:

$ podman build --platform linux/arm64 -t armbuilder -v ${PWD}:/workspace .   # Once
$ podman run --platform linux/arm64/v8 -v ${PWD}:/workspace armbuilder

The second command I've run in various ways to try to identify the problem, the most recent failing variation was:

$ podman run -it --platform linux/arm64/v8 -v ${PWD}:/workspace armbuilder go build -v -o build/linux_arm64 ./cmd/dlg

If I add the -x flag, it almost(?) always compiles within a few minutes. I haven't seen it fail yet with -x, and I haven't yet seen it not hang without it.

This machine is an AMD Ryzen 7 5800H, which I think is technically a mobile CPU; it has 16 cores and the machine it's in has 32GB RAM. I don't think I've ever touched the swap space, or gotten to less than 10GB free in the past year I've owned it.

I've tried with both the official alpine image, and more recently (because I need glibc linkage for my target platform) with wolfi (cgr.dev/chainguard/wolfi-base:latest).

To reproduce (hopefully it's reproducable off my machine), pull the bookmark "go-build-hang-issue".

What did you see happen?

The first time I got it to compile without dependency errors, it ran for a couple of hours and I left it overnight. The next morning -- about 12 hours after starting the build -- I checked and it was still hung up on the package it was compilyng when I left it the night before. Every attempt since hangs at the same place, even when the image is deleted and re-created. It hangs on this step:

cd /usr/lib/go/src/math
/usr/lib/go/pkg/tool/linux_arm64/asm -p math -trimpath "$WORK/b038=>" -I $WORK/b038/ -I /usr/lib/go/pkg/include -D GOOS_linux -D GOARCH_arm64 -gensymabis -o $WORK/b038/symabis ./dim_arm64.s ./exp_arm64.s ./floor_arm64.s ./modf_arm64.s

A single core is pegged. As I said, if I build with -x it will make it through the entire build in minutes. If I use only -v, or no flags, it hangs.

What did you expect to see?

I expect the build to:

  1. Fail with an error message.
  2. or Succeed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.

    Type

    Fields

    No fields configured for Bug.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions