-
Notifications
You must be signed in to change notification settings - Fork 17.9k
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: GO111MODULE=on go build requires gcc #26988
Comments
It's surprising that cc @myitcv |
Edit: fixed bad copy-paste. Reproduced:
exits non-zero with:
whereas:
just works. |
I installed go1.11 from archive
FYI,
|
It's not that surprising, and it's fine for Go 1.11. |
I find it surprising. It's a pain when there's no
It looks like setting
|
@rsc Can you expand a bit? It was certainly a surprise for me :) I started seeing this after upgrade to 1.11. Feels like a breaking change to the end-user if my build worked before upgrade and doesn't work now. Just want to understand what changed in more detail and what proper remediation is. Thanks! |
Regarding this issue, Russ commented:
Note this issue is specific to opting in to modules (and related to the fact that Go 1.11 ships non-module based packages because the modules system overall is still opt-in only in Go 1.11). This particular issue should not be affecting non-module based builds as far as I understand it. |
@thepudds Thanks! Can you link me to the original context for that comment? Also, would we expect this to affect builds that pull in deps that might use modules? We did not opt into modules and were seeing issues on 1.11. |
The original report of this issue required (You can check whether module mode is active by running |
Noticed a similar issue in our pipeline when switching from 1.10.x to 1.11.0. Specifically with the We explicitly set
The solution, as mentioned before, was to explicitly set |
We ran into the same issue when upgrading from To clarify, this is when building a package inside
For now I'll just globally set |
Hi @mvdan , given you are seeing that behavior outside of modules (including an empty GOMOD reported by I think that was the suggestion from @bcmills several comments back:
As far as I am following things, it sounds like there might be at least three distinct behaviors:
|
Agreed, will open a new issue. I posted here first, in case I was missing something obvious or misunderstanding how GO11MODULE affected this issue. |
Hi @mvdan, makes sense that you posted here first. Overall, not 100% clear what's going on with the more recent reports here, and some chance there might be multiple underlying causes that might initially seem to have similar symptoms... |
This is expected: we can only ship one pre-compiled copy of the standard library, and the pre-compiled copy we ship is for non-modules (GOPATH) mode. If we need standard library packages in module mode then we may need to rebuild them if there are any changes needed. In this case the slightly different effect of the vendor folder means that changes are needed. One way to fix this for Go 1.12 would be to rename the top-level vendor folder to something different (internal/...) and fix the imports to match. We should probably do that. |
Note the fix is to change the import path of the vendor folder. |
Change https://golang.org/cl/147443 mentions this issue: |
CL 147443 fixed the known cause of these symptoms. Please open a new issue if you continue to observe them with a |
When the smoke tests release was updated to Go v1.11.2, the BOSH release pipelines all passed, but pipelines that consumed the final release failed because `gcc` was not installed. This is a very similar issue to golang/go#26988. Experiments showed that adding `CGO_ENABLED=0 GO111MODULE=off` to disable `cgo` and Go moudles allowed the smoke tests to pass. These variables should be removed when we recieved an updated version of Go (after 1.11.2). [#159658309]
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Not sure
What operating system and processor architecture are you using (
go env
)?What did you do?
Build a minimal http server failed with
GO111MODULE=on go build
What did you expect to see?
GO111MODULE=on go build
produces binary.What did you see instead?
Build failed due to missing
gcc
.Either of these commands works fine though:
The text was updated successfully, but these errors were encountered: