-
Notifications
You must be signed in to change notification settings - Fork 17.7k
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: TestScript/list_std_stale fails if CGO_CFLAGS was set to a custom value during ./make.bash #46347
Comments
Probably we should either explicitly propagate or explicitly clear out every environment variable in the union of That way we can at least make a conscious decision about which environment variables should affect the test. |
The current plan in #46292 is to rely on this testing issue being resolved to unblock the release, so transitively applying release-blocker label. |
Hmm, I'm thinking about this some more. If |
The change to set When I looked into it more recently for darwin/arm64 in CL 278435 I hadn't found a way to confirm that setting |
I think the default I also wonder why we don't have the same problem with ARM builders from setting the |
It looks like cmd/go's TestScript is completely skipped on GOARCH=arm via |
If that's possible, I think it would likely be an improvement. The fewer special cases we need to maintain in x/build/cmd/release (which apply on top of make.bash and cmd/go but only during the release process and release testing), the better. I wanted to verify that the original report in this issue applies more generally, so I tested on linux/amd64, and can confirm it also reproduces with something like this:
(The same test passes if CGO_CFLAGS in unset before make.bash.) |
Apparently it is not reported stale if the same flag is passed at staleness check and at make.bash. Does |
We have another existing staleness check that is currently skipped on
If |
I don't think we check binary staleness when invoking a tool binary. The go command just invokes the installed binary, whether it is stale or not. |
This sounds like we may want to somehow bake the make.bash-time CGO_CFLAGS into the toolchain. On the other hand, what if a user just wants to set CGO_CFLAGS when building the standard library and toolchain, but not when building user code? Or maybe nobody wants to do that... |
I could perhaps see someone setting I don't think that would make sense for the standard library, though — it would just cause each cgo-enabled standard-library package to be rebuilt when the user first builds a program that imports it. |
Hmm, ok. So the impact of a
|
Looking at the above, several things stand out:
|
I still think that test should not check linker staleness at all. (This was added just to help local development.) |
It appears that |
The problem seems to be a build ID mismatch. The build ID stored in |
The problem occurs when setting any of the CGO flags. From cgo documentation:
Adding an
and
On the other hand:
|
Change https://golang.org/cl/322629 mentions this issue: |
I have a doubt: if for packages using |
The build ID is not meaningless — that determines whether the package needs to be rebuilt. It just happens that “rebuilding a package” is not nearly as big a deal now that we always have a build cache. |
Change https://golang.org/cl/381854 mentions this issue: |
…aleness The configuration set by x/build/cmd/releasebot causes runtime/cgo to be stale in the darwin/amd64 release (see #36025, #35459). That staleness is mostly benign because we can reasonably assume that users on macOS will either disable CGO entirely or have a C compiler installed to rebuild (and cache) the stale packages if needed. Fixes #50892 Fixes #50893 Updates #46347 Change-Id: Ib9ce6b5014de436264238f680f7ca4ae02c9a220 Reviewed-on: https://go-review.googlesource.com/c/go/+/381854 Trust: Bryan Mills <[email protected]> Run-TryBot: Bryan Mills <[email protected]> TryBot-Result: Gopher Robot <[email protected]> Reviewed-by: Russ Cox <[email protected]>
As found by @bcmills in #46292, this happens on tip (tested with commit 52d7033).
go env
OutputWhat did you do?
What did you expect to see?
A test result that verifies issue #44725 is fixed, or a skipped test execution if the current environment doesn't make it possible to run the test reliably.
What did you see instead?
The test fails if ./make.bash was run with
CGO_CFLAGS
set as above.Unsetting the env var afterwards doesn't make a difference:
Edit: Simplified reproduce case from
CGO_CFLAGS='-mmacosx-version-min=10.13'
toCGO_CFLAGS='-O3'
.The text was updated successfully, but these errors were encountered: