-
Notifications
You must be signed in to change notification settings - Fork 18k
cmd/go: regression on the default of CGO_ENABLED to 0 for cross builds #33673
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
Comments
I cannot reproduce this. I got
It seems to me that for cross compilation CGO_ENABLED has been always 0, since at least go 1.6. |
I cannot reproduce this regression either. Perhaps provide clearer steps? Does this happen in a Docker image that we can use to reproduce?
|
Also, as per https://go.googlesource.com/proposal/+/master/design/30411-env.md, do you have anything in your |
@mvdan Did you mean to ask if @bufflig exported CGO_ENABLED="1" at some point before running the command (since the
|
As others have said, the intent since the beginning has been to default |
Timed out in state WaitingForInfo. Closing. (I am just a bot, though. Please speak up if this is a mistake or you have the requested information.) |
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes, it is with the latest release
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
When cross compiling on 1.13 (tip), CGO is disabled by default. This is a change of behavior since 1.12.
1.12:
GOARCH=ppc64le go env | grep CGO_ENABLED
CGO_ENABLED="1"
1.13:
GOARCH=ppc64le go env | grep CGO_ENABLED
CGO_ENABLED="0"
The cl introducing the change is https://golang.org/cl/171137
The cl description does not clearly state the changed behavior.
What did you expect to see?
CGO_ENABLED="1"
Either the unchanged behavior, or the changed behavior pointed out in the cl description and possibly even in release notes?
The changed behavior makes sense, as the environment needs to be updated anyway to get CGO to work when cross compiling, so an "out of the box" behavior where it's disabled makes sense. So fwiw, my suggestion is to just document it.
What did you see instead?
CGO_ENABLED="0"
We could either revert to the old behavior, or the changed behavior pointed out in the cl description and possibly even in release notes?
The changed behavior makes sense, as the environment needs to be updated anyway to get CGO to work when cross compiling, so an "out of the box" behavior where it's disabled makes sense. So fwiw, my suggestion is to just document it.
The text was updated successfully, but these errors were encountered: