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

Open
benesch opened this Issue Feb 1, 2019 · 6 comments

Comments

Projects
None yet
4 participants
@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 label Feb 1, 2019

@bradfitz bradfitz added this to the Go1.13 milestone Feb 1, 2019

@bradfitz

This comment has been minimized.

Copy link
Member

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

This comment has been minimized.

Copy link
Member

bradfitz commented Feb 1, 2019

@gopherbot

This comment has been minimized.

Copy link

gopherbot commented Feb 2, 2019

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

@benesch

This comment has been minimized.

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

This comment has been minimized.

Copy link
Contributor

ianlancetaylor commented Feb 2, 2019

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

This comment has been minimized.

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 :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment