-
Notifications
You must be signed in to change notification settings - Fork 17.7k
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: cgo crashes with GO15VENDOREXPERIMENT=1 #11913
Comments
Is your environment list complete? In particular, do you have GOROOT set in the environment? Can you describe a sequence of steps we can use to recreate the problem? |
Thanks for the quick response, Ian! rsc@ reached out privately for access to the source repositories necessary to reproduce the issue, which I've granted - I can add you to the projects as well if you'd like. Here's the output of "go env" - note that GOROOT is indeed set, to my Go 1.5 beta 2 installation. I have Go 1.4 installed but it should be unused - it's on a different mount that isn't referenced below. GOARCH="amd64" |
As an aside, I'm building the newly released Go 1.5 beta 3 to see if maybe this was already fixed, and will update the issue with the result. |
The misbehavior is still present when building with Go 1.5 beta 3. |
CL https://golang.org/cl/13022 mentions this issue. |
The fix for this change broke "go get -v all" for me:
My environment:
After re-building Go, I am currently working around this problem by invoking "go install -v all" instead", to re-build my packages. |
When performing a clean build of our project with GO15VENDOREXPERIMENT=1 we need to run "go install" twice. The first time always fails in cgo-related compile or link steps. The second time always works fine.
I'm running "go version go1.5beta2 linux/amd64".
The error from cgo is usually different from run to run. I've also seen cgo crash with a nil pointer error. These are the environment variables we set when building:
BUILD=//home/adgar/go/src//vendor/libgit2/build
PCFILE=//home/adgar/go/src//vendor/libgit2/build/libgit2.pc
PKG_CONFIG_PATH=//home/adgar/go/src//vendor/libgit2/build:
FLAGS='-L//home/adgar/go/src//vendor/libgit2/install/lib -lgit2 -lcurl -lrt -lssl -lcrypto -ldl -lz '
CGO_LDFLAGS='//home/adgar/go/src//vendor/libgit2/build/libgit2.a -L//home/adgar/go/src//vendor/libgit2/build -L//home/adgar/go/src//vendor/libgit2/install/lib -lgit2 -lcurl -lrt -lssl -lcrypto -ldl -lz '
CGO_CFLAGS=-I//home/adgar/go/src//vendor/libgit2/include
Here are 3 example errors I've seen in the past ~5 minutes of reproducing the issue.
[run 1]
cannot parse gcc output $WORK//vendor/github.com/libgit2/git2go/_obj//cgo.o as ELF, Mach-O, PE object
[run 2]
vendor/github.com/libgit2/git2go/diff.go:20:31: unable to find value of constant C.GIT_DIFF_FLAG_BINARY
vendor/github.com/libgit2/git2go/diff.go:21:31: unable to find value of constant C.GIT_DIFF_FLAG_NOT_BINARY
vendor/github.com/libgit2/git2go/diff.go:22:31: unable to find value of constant C.GIT_DIFF_FLAG_VALID_ID
vendor/github.com/libgit2/git2go/diff.go:42:38: unable to find value of constant C.GIT_DIFF_LINE_CONTEXT
vendor/github.com/libgit2/git2go/diff.go:43:38: unable to find value of constant C.GIT_DIFF_LINE_ADDITION
vendor/github.com/libgit2/git2go/diff.go:44:38: unable to find value of constant C.GIT_DIFF_LINE_DELETION
vendor/github.com/libgit2/git2go/diff.go:45:38: unable to find value of constant C.GIT_DIFF_LINE_CONTEXT_EOFNL
vendor/github.com/libgit2/git2go/diff.go:46:38: unable to find value of constant C.GIT_DIFF_LINE_ADD_EOFNL
vendor/github.com/libgit2/git2go/diff.go:47:38: unable to find value of constant C.GIT_DIFF_LINE_DEL_EOFNL
vendor/github.com/libgit2/git2go/diff.go:49:33: unable to find value of constant C.GIT_DIFF_LINE_FILE_HDR
vendor/github.com/libgit2/git2go/diff.go:50:33: unable to find value of constant C.GIT_DIFF_LINE_HUNK_HDR
vendor/github.com/libgit2/git2go/diff.go:51:33: unable to find value of constant C.GIT_DIFF_LINE_BINARY
vendor/github.com/libgit2/git2go/diff.go:62:26: type C.git_diff_file: undefined C type 'git_diff_file'
vendor/github.com/libgit2/git2go/diff.go:64:10: call of non-function C.GoString
vendor/github.com/libgit2/git2go/diff.go:80:28: type C.git_diff_delta: undefined C type 'git_diff_delta'
vendor/github.com/libgit2/git2go/diff.go:98:26: type C.git_diff_hunk: undefined C type 'git_diff_hunk'
vendor/github.com/libgit2/git2go/diff.go:104:13: call of non-function C.GoStringN
panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xb code=0x1 addr=0x0 pc=0x40ec96]
goroutine 1 [running]:
main.(_Package).rewriteRef(0xc8200942a0, 0xc8202fc300)
//home/adgar/go15/go/src/cmd/cgo/gcc.go:610 +0x1466
main.(_Package).Translate(0xc8200942a0, 0xc8202fc300)
//home/adgar/go15/go/src/cmd/cgo/gcc.go:170 +0x197
main.main()
//home/adgar/go15/go/src/cmd/cgo/main.go:269 +0x1059
[run 3, mojibaked]
/cmd/ws-daemon
//home/adgar/go/pkg/linux_amd64//vendor/github.com/libgit2/git2go.�): not an object file
//home/adgar/go/pkg/linux_amd64//vendor/github.com/libgit2/git2go.a���): not an object file
//home/adgar/go/pkg/linux_amd64//vendor/github.com/libgit2/git2go.aþ �): not an object file
//home/adgar/go/pkg/linux_amd64//vendor/github.com/libgit2/git2go.a(ü ): not an object file
//home/adgar/go/pkg/linux_amd64//vendor/github.com/libgit2/git2go.a(�8
): not an object file
//home/adgar/go/pkg/linux_amd64//vendor/github.com/libgit2/git2go.a(X
): not an object file
//home/adgar/go/pkg/linux_amd64//vendor/github.com/libgit2/git2go.a(ex
): not an object file
//home/adgar/go/pkg/linux_amd64//vendor/github.com/libgit2/git2go.a(�
%p�
): not an object file
//home/adgar/go/pkg/linux_amd64//vendor/github.com/libgit2/git2go.a(�°
2): not an object file
//home/adgar/go/pkg/linux_amd64//vendor/github.com/libgit2/git2go.a(
¡): not an object file
//home/adgar/go/pkg/linux_amd64//vendor/github.com/libgit2/git2go.a(
): not an object file
//home/adgar/go/pkg/linux_amd64//vendor/github.com/libgit2/git2go.a(): not an object file
//home/adgar/go/pkg/linux_amd64//vendor/github.com/libgit2/git2go.a(E¬): not an object file
//home/adgar/go/pkg/linux_amd64//vendor/github.com/libgit2/git2go.a(W.
): not an object file
//home/adgar/go/pkg/linux_amd64//vendor/github.com/libgit2/git2go.a(
=�): not an object file
//home/adgar/go/pkg/linux_amd64//vendor/github.com/libgit2/git2go.a(£.
): not an object file
//home/adgar/go/pkg/linux_amd64//vendor/github.com/libgit2/git2go.a(
«�): not an object file
//home/adgar/go/pkg/linux_amd64//vendor/github.com/libgit2/git2go.a(0/
): not an object file
//home/adgar/go/pkg/linux_amd64//vendor/github.com/libgit2/git2go.a(
Ə): not an object file
//home/adgar/go/pkg/linux_amd64//vendor/github.com/libgit2/git2go.a(¤/
): not an object file
//home/adgar/go/pkg/linux_amd64//vendor/github.com/libgit2/git2go.a(
��): not an object file
//home/adgar/go15/go/pkg/tool/linux_amd64/link: too many errors
The text was updated successfully, but these errors were encountered: