Skip to content

cmd/go: cgo build results depend on random tmp path #81040

Open

Description

@bmwiedemann

Go version

go version go1.27rc2 linux/amd64

Output of go env in your module/workspace:

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

What did you do?

I'm working on reproducible builds for openSUSE, I found that
our esbuild-0.28.2 package varies across builds, unless LTO is disabled.

What did you see happen?

cgo uses a random /tmp/go-buildNNNN path and that gets embedded into debuginfos.

What did you expect to see?

Build results should be deterministic and bit-reproducible.

A gcc16 patch is only half of the solution.

Activity

  1. added a commit that references this issue on Aug 23, 2026
    7de3bba
  2. gopherbot commented on Aug 23, 2026

    @gopherbot
    Contributor

    Change https://go.dev/cl/819900 mentions this issue: cmd/go: use Objdir-relative paths in cgo compile action IDs

  3. added
    NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.
    on Aug 28, 2026
  4. dr2chase commented on Aug 28, 2026

    @dr2chase
    Contributor

    @golang/go-command

  5. added
    cgoIssues affecting runtime/cgo and cmd/go
    on Sep 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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.cgoIssues affecting runtime/cgo and cmd/go

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions