build/ci.go: don't set CC for go run ci.go, only inside#15784
Merged
Conversation
fjl
approved these changes
Jan 2, 2018
mariameda
pushed a commit
to NiluPlatform/go-nilu
that referenced
this pull request
Aug 23, 2018
This avoids setting CC for the go run invocation, which fails on go1.10.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Our
build/ci.goscript + travic config combo was incorrect from a Go tooling standpoint, but worked correctly up to Go 1.9 due to limitations of Go itself. Go 1.10 fixes the limitations, causing our CI script to break.The issue lies in the way we pass the C compiler for cross compilation to
ci.go. Currently we just setCCbefore callinggo run build/ci.go, which will get passed to the inside cross compilation invocation. The issue is that this in reality setsCCfor the outergo runtoo, not just cross compilation. So in theory ifci.godepended on CGO, things would blow up because we try to use some cross compiler to build for the host.Unfortunately,
ci.godoes indeed depend on CGO through some arbitrary dependency path. The reason we never hit this issue is because Go 1.9 and below just looked atruntime/cgo.a, saw that it was recent and didn't try to rebuild. Go 1.10 gets a bit smarter, and notices that the C compiler changed, so it will try to rebuildruntime/cgo, which will result in all kinds of failures when the C compiler is actually a cross compilat for a different platform/architecture (e.g. arm).This PR fixes the issue by not specifying the C compiler through the outer
CCenv var, rather sets it as a flag toci.go install, which will internally convert it into aCCenv var before invoking the cross compiling Go step.More details and discussion on the Go issue tracker: golang/go#23288