-
Notifications
You must be signed in to change notification settings - Fork 17.5k
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: do not modify environment for 'go run' #11709
Comments
We need to know what your build.go program does. Normally CGO_ENABLED is set to false for a cross-compiler. That code is in defaultContext in the go/build package, and it has not changed since 1.4. Apparently something has changed somewhere, but without knowing what build.go does I don't know what it is. |
Yeah, I figured it out. The build script itself does nothing fancy apart from building the parameter lists above and then running "go" with them. However, when I Something here seems to have changed, but it may as well just be the fact that packages are built on the fly for cross compilation rather than as it was before. |
I'll close this, but feel free to reopen if you find out what changed and think it should be changed back. |
What changed is that "go run" now sets a number of environment variables it didn't before:
If this is intentional, I guess it's fine. Possibly it should be documented somewhere. |
Thanks for looking into it. The change was intentional: https://go-review.googlesource.com/6409 . Reopening to document this. |
The change was intentional for things like go tool compile. It was not meant to affect go run. That's a bug and should be fixed. |
CL https://golang.org/cl/12483 mentions this issue. |
CL https://golang.org/cl/13449 mentions this issue. |
Fixes #12096. Followup to CL 12483, which fixed #11709 and #11449. Change-Id: I9031ea36cc60685f4d6f65c39f770c89b3e3395a Reviewed-on: https://go-review.googlesource.com/13449 Reviewed-by: Ian Lance Taylor <iant@golang.org>
For example compiling for dragonfly/amd64 on darwin/amd64:
(Via a build script, but what happens is just a setting of GOPATH for vendoring and some ldflags for version tagging being added)
I'm not sure what it's trying to do, but the error sounds like it's trying to compile stuff for dragonfly using the system compiler, which is obviously quite different from what would exist on actual dragonfly. Disabling cgo makes it work:
Is this expected? (cgo not working is obviously expected, what surprises me is that it seems to try to enable it by default.)
(I see similar but different errors on linux/amd64 -> dragonfly/amd64 so this one at least is not darwin specific)
The text was updated successfully, but these errors were encountered: