Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

go/build: build cache does not properly take AR into account #30046

Closed
benesch opened this issue Feb 1, 2019 · 7 comments
Closed

go/build: build cache does not properly take AR into account #30046

benesch opened this issue Feb 1, 2019 · 7 comments
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@benesch
Copy link
Contributor

benesch commented Feb 1, 2019

What version of Go are you using (go version)?

$ go version
go version devel +faf187fb8e Thu Jan 31 16:55:43 2019 +0000 linux/amd64

What operating system and processor architecture are you using (go env)?

go env Output
$ go env
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/benesch/.cache/go-build"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/benesch/go"
GORACE=""
GOROOT="/usr/lib/go-1.10"
GOTMPDIR=""
GOTOOLDIR="/usr/lib/go-1.10/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build519384162=/tmp/go-build -gno-record-gcc-switches"

What did you do?

AR=gcc-ar go build

What did you expect to see?

A successful build using the gcc-ar wrapper that supports LTO.

What did you see instead?

A cached failure using the old value of AR:

$ AR=gcc-ar go build
ar: $WORK/b007/_go_.o: plugin needed to handle lto object

Dropping the cache first makes the build properly use the specified AR:

$ go clean -cache
$ AR=gcc-ar go build
# Success.

By my read, a063a22 doesn't interact with the build cache at all, and it probably should.

@bradfitz bradfitz added the NeedsFix The path to resolution is known, but the work has not been done. label Feb 1, 2019
@bradfitz bradfitz added this to the Go1.13 milestone Feb 1, 2019
@bradfitz
Copy link
Contributor

bradfitz commented Feb 1, 2019

We can cherry-pick the fix back to Go 1.12 if the fix happens after Go 1.12 is out. (this alone won't halt the release)

@bradfitz
Copy link
Contributor

bradfitz commented Feb 1, 2019

/cc @ianlancetaylor

@gopherbot
Copy link

Change https://golang.org/cl/160897 mentions this issue: cmd/go: include AR env var in gccgo build IDs

@benesch
Copy link
Contributor Author

benesch commented Feb 2, 2019

Is this bug important enough to warrant inclusion in Go 1.12? I'm using tip so I don't care if this misses 1.12. Regardless, the fix seems simple; see the CL above.

@ianlancetaylor
Copy link
Contributor

I don't think this needs to go into 1.12. You are likely the only person who is trying to change the ar program they are using.

@benesch
Copy link
Contributor Author

benesch commented Feb 3, 2019

Yes, I agree. Though I suspect that there are at least two of us, given that I didn't author a063a22 :)

@bradfitz
Copy link
Contributor

gopherbot pushed a commit that referenced this issue Apr 23, 2019
The gccgo toolchain uses the archiver specified by the AR environment
variable, or `ar` by default. Teach the build ID to take the value of
this environment variable into account, since different archivers can
produce different results.

Fix #30046.

Change-Id: Ia6821258d54eecedb9026afc38a515cd564c45cb
Reviewed-on: https://go-review.googlesource.com/c/go/+/160897
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
@golang golang locked and limited conversation to collaborators Apr 22, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

No branches or pull requests

4 participants