You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
cmd/compile: CGO arm builds fail on Go 1.10beta1 #23288
You assume we know how to build (or how you built) go-ethereum. How can we reproduce this to debug? I'm sure it's in that travis log somewhere, but a concise repro in the bug would be nice.
Hmm, the issue seems to come from go run build/ci.go (not from the cross compilation invoked within), which for some reason wants to build runtime/cgo, so my CC env var makes that fail:
Now, I could understand why this would fail if ci.go would depend on cgo, but it does not, rather it (and all its dependency tree) is pure Go, so go run shouldn't try to build runtime/cgo, yet it does.
Note, I can fix my issue by not setting CC, rather perhaps passing the compiler as a flag to ci.go and have that set it as an env var internally before invoking the cross compilation. However, it would be nice to know why go run wants to touch CGO, without a dependency for it.
Emphasis that this only happens with Go 1.10. None of the previous versions of Go touch runtime/cgo when building my build/ci.go file.
But why does Go 1.10beta1 want to rebuild runtime/cgo, but previous versions of Go didn't want to do that?
Because you got lucky before. Go 1.10 has proper build caching based on file contents and all relevant environment variables. Go 1.9 and earlier depended heavily on modtimes of files only (not contents) and ignored many important environment variables.
That is, in Go 1.9 and before, your runtime/cgo had already been built, so your CC=foo go run ci.go wasn't rebuilding it. But in Go 1.10, it assumes the new $CC value invalidates the cached results (whose cache key includes a different $CC) and rebuilds it.
Sweet, that's what I was also guessing based on Florin's Advent post, just wanted to confirm. Thank you very much for your time on this, and sorry for the false alarm!
Activity
bradfitz commentedon Dec 30, 2017
You assume we know how to build (or how you built)
go-ethereum. How can we reproduce this to debug? I'm sure it's in that travis log somewhere, but a concise repro in the bug would be nice./cc @ianlancetaylor
karalabe commentedon Dec 30, 2017
Fair enough, I'll try to cook up a repro for you.
bradfitz commentedon Dec 30, 2017
Maybe your
GOARM=5 CC=arm-linux-gnueabi-gcc go run build/ci.go install -arch armshould beCC_FOR_TARGETinstead.karalabe commentedon Dec 30, 2017
Hmm, the issue seems to come from
go run build/ci.go(not from the cross compilation invoked within), which for some reason wants to buildruntime/cgo, so myCCenv var makes that fail:Now, I could understand why this would fail if
ci.gowould depend oncgo, but it does not, rather it (and all its dependency tree) is pure Go, sogo runshouldn't try to buildruntime/cgo, yet it does.Note, I can fix my issue by not setting CC, rather perhaps passing the compiler as a flag to
ci.goand have that set it as an env var internally before invoking the cross compilation. However, it would be nice to know whygo runwants to touch CGO, without a dependency for it.Emphasis that this only happens with Go 1.10. None of the previous versions of Go touch
runtime/cgowhen building mybuild/ci.gofile.bradfitz commentedon Dec 30, 2017
You can inspect dependencies with
go list -jsonto see why there's a path toruntime/cgo.bradfitz commentedon Dec 30, 2017
(If ci.go uses os/user or net, it'll probably depend on cgo by default.)
karalabe commentedon Dec 30, 2017
Hmm, indeed,
runtime/cgois indeed listed as some dependency:But why does Go 1.10beta1 want to rebuild
runtime/cgo, but previous versions of Go didn't want to do that?bradfitz commentedon Dec 30, 2017
Because you got lucky before. Go 1.10 has proper build caching based on file contents and all relevant environment variables. Go 1.9 and earlier depended heavily on modtimes of files only (not contents) and ignored many important environment variables.
bradfitz commentedon Dec 30, 2017
That is, in Go 1.9 and before, your
runtime/cgohad already been built, so yourCC=foo go run ci.gowasn't rebuilding it. But in Go 1.10, it assumes the new $CC value invalidates the cached results (whose cache key includes a different $CC) and rebuilds it.karalabe commentedon Dec 30, 2017
Sweet, that's what I was also guessing based on Florin's Advent post, just wanted to confirm. Thank you very much for your time on this, and sorry for the false alarm!