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

cmd/go: can't rebuild new versions of Go in place from commit b7c600d onward #21475

Closed
siebenmann opened this issue Aug 16, 2017 · 2 comments
Closed

Comments

@siebenmann
Copy link

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

This happens with any version from go version devel +b7c600d Mon Aug 14 18:45:21 2017 +0000 linux/amd64 onward, and reproduces in the current git tip go version devel +9c9df65.

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

GOARCH="amd64"
GOOS="linux"

What did you do?

If you have a git clone of the Go tree on amd64 Linux, you update the tree with eg 'git pull', and you attempt to rebuild without removing linux_amd64_shared/runtime/cgo.a, you'll get a failure during TestBuildmodePIE:

--- FAIL: TestBuildmodePIE (1.19s)
        go_test.go:312: running testgo [build -buildmode=pie -o /tmpfs/gotest561625280/main /tmpfs/gotest561625280/main.go]
        go_test.go:325: standard error:
        go_test.go:326: # command-line-arguments
                /tmp/go/pkg/linux_amd64_shared/runtime/cgo.a(_go_.o): object is [linux amd64 devel +25b040c Wed Aug 16 10:07:47 2017 +0000 X:framepointer] expected [linux amd64 devel +b26ad60 Wed Aug 16 15:30:35 2017 +0000 ]
                /tmp/go/pkg/linux_amd64_shared/runtime/cgo.a(asm_amd64.o): object is [linux amd64 devel +25b040c Wed Aug 16 10:07:47 2017 +0000] expected [linux amd64 devel +b26ad60 Wed Aug 16 15:30:35 2017 +0000 ]

        go_test.go:335: go [build -buildmode=pie -o /tmpfs/gotest561625280/main /tmpfs/gotest561625280/main.go] failed unexpectedly: exit status 2
FAIL
FAIL    cmd/go  40.721s

A typical reproduction on a system with a /usr/bin/go is:

  • clone the git repo into /tmp: cd /tmp; git clone https://go.googlesource.com/go
  • set up to build: export GOROOT_BOOTSTRAP=$(/usr/bin/go env GOROOT)
  • step back a version or two: cd go; git checkout 25b040c
  • build and test that version: cd src; ./all.bash
  • check out the current version: git checkout master
  • try to build and test the current version: ./all.bash

The last step will fail. Removing the cgo.a file and retrying the ./all.bash will cause the build to succeed.

My testing says that this was introduced in commit b7c600d, 'cmd/go, cmd/link: enable buildmode=pie on darwin/amd64', intended to fix #21220. This commit is where TestBuildmodePIE is added.

@ALTree
Copy link
Member

ALTree commented Aug 16, 2017

Dup of #21452

@ianlancetaylor
Copy link
Contributor

Closing as dup.

@golang golang locked and limited conversation to collaborators Aug 16, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants