Skip to content

build: TestBuildmodePIE failed on linux #21452

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

Closed
choleraehyq opened this issue Aug 15, 2017 · 11 comments
Closed

build: TestBuildmodePIE failed on linux #21452

choleraehyq opened this issue Aug 15, 2017 · 11 comments
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@choleraehyq
Copy link
Contributor

Please answer these questions before submitting your issue. Thanks!

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

use go 1.9 rc2 to compile go tip 58cb8a3c8fdc9b83cb8630f17d0ee641eb0327cc

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

GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/cholerae/gopath"
GORACE=""
GOROOT="/home/cholerae/gopath/go"
GOTOOLDIR="/home/cholerae/gopath/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build447838512=/tmp/go-build -gno-record-gcc-switches"
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"

What did you do?

If possible, provide a recipe for reproducing the error.
A complete runnable program is good.
A link on play.golang.org is best.
GOROOT_BOOTSTRAP=/home/cholerae/gopath/go ./all.bash

What did you expect to see?

all tests passed.

What did you see instead?

--- FAIL: TestBuildmodePIE (2.15s)
	go_test.go:312: running testgo [build -buildmode=pie -o /tmp/gotest833919002/main /tmp/gotest833919002/main.go]
	go_test.go:325: standard error:
	go_test.go:326: # command-line-arguments
		/home/cholerae/test/go/pkg/linux_amd64_shared/runtime/cgo.a(_go_.o): object is [linux amd64 devel +adc28cb1e0 Fri Aug 11 18:00:53 2017 +0000 X:framepointer] expected [linux amd64 devel +58cb8a3c8f Tue Aug 15 07:19:25 2017 +0000 ]
		/home/cholerae/test/go/pkg/linux_amd64_shared/runtime/cgo.a(asm_amd64.o): object is [linux amd64 devel +adc28cb1e0 Fri Aug 11 18:00:53 2017 +0000] expected [linux amd64 devel +58cb8a3c8f Tue Aug 15 07:19:25 2017 +0000 ]
		
	go_test.go:335: go [build -buildmode=pie -o /tmp/gotest833919002/main /tmp/gotest833919002/main.go] failed unexpectedly: exit status 2
FAIL
FAIL	cmd/go	67.917s
@ALTree
Copy link
Member

ALTree commented Aug 15, 2017

Same on my linux/amd64 system.

I bisected this to b7c600d

cc @hirochachacha @ianlancetaylor

@ALTree ALTree added this to the Go1.10 milestone Aug 15, 2017
@ALTree ALTree added release-blocker NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. labels Aug 15, 2017
@hirochachacha
Copy link
Contributor

I didn't change anything about Linux.
Could you compile a trivial program with buildmode=pie ?
e.g.

$ cat main.go
package main; func main() { print("hello") }
$ go build -buildmode=pie -o main main.go

Thank you.

@ALTree
Copy link
Member

ALTree commented Aug 15, 2017

$ cat test.go
package main

func main() {
	print("hello")
}

$ gotip version
go version devel +583a941d4e Tue Aug 15 10:10:42 2017 +0000 linux/amd64

$ gotip build -buildmode=pie test.go
# command-line-arguments
/home/alberto/go/pkg/linux_amd64_shared/runtime/cgo.a(_go_.o): object is [linux amd64 devel +ae24c167c7 Mon Aug 14 14:52:00 2017 +0200 X:framepointer] expected [linux amd64 devel +583a941d4e Tue Aug 15 10:10:42 2017 +0000 ]
/home/alberto/go/pkg/linux_amd64_shared/runtime/cgo.a(asm_amd64.o): object is [linux amd64 devel +ae24c167c7 Mon Aug 14 14:52:00 2017 +0200] expected [linux amd64 devel +583a941d4e Tue Aug 15 10:10:42 2017 +0000 ]

Ah, it bisected to your change because that's the one that added that PIE test... but -buildmode=pie was already broken. I checked out the commit before yours and it gives the same error.

@hirochachacha
Copy link
Contributor

I see. It seems the compiler should recompile dependent packages if it is necessary, instead of error. I don't know where that logic is defined though.

@hirochachacha
Copy link
Contributor

Anyway, thank you for your confirmation.

@ALTree ALTree removed this from the Go1.10 milestone Aug 15, 2017
@ALTree
Copy link
Member

ALTree commented Aug 15, 2017

Cleaning out manually the old pkgs works as a workaround to fix all.bash. Anyway it would be nice if the toolchain could figure this out by itself.

@ianlancetaylor
Copy link
Contributor

I think this is basically a bug in cmd/go: it doesn't take relevant flag settings into account when deciding whether it needs to rebuild a package.

Until cmd/go is fixed we can fixed TestBuildmodePIE by using an -installsuffix option in the test.

@jessfraz
Copy link
Contributor

I can fix the test

@gopherbot
Copy link
Contributor

Change https://golang.org/cl/55812 mentions this issue: cmd/go: add -installsuffix to TestBuildmodePIE

@ianlancetaylor
Copy link
Contributor

I see the problem, it's in cmd/go. Will send a CL.

@gopherbot
Copy link
Contributor

Change https://golang.org/cl/57231 mentions this issue: cmd/go: -buildmode=pie forces external linking mode on all systems

@golang golang locked and limited conversation to collaborators Aug 21, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

No branches or pull requests

6 participants