-
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: explicitly specify macOS base SDK version when compiling go binary #35459
Comments
It seems that we want to specify the #18400 is related. |
The fact that the SDK isn’t specified in the Mach-O headers makes me wonder if the xcode toolchain we’re using to compile cgo binaries at release time may need to be updated. When I build the toolchain on a
When running |
If the Go linker detects a load command in an external .o file, it will use that. We can't just pass In internal linking mode, the Go linker sets a default LC_VERSION_MIN_MACOSX version. The version was bumped to 10.9 in https://go-review.googlesource.com/c/go/+/175918/. Perhaps it's enough to update/fix the toolchain used to build Go release. However, we could also expand the linker check above ("machoPlatform == 0") to trigger when the version and sdk are less than 10.9 in external linking mode. If you do that, please keep my https://go-review.googlesource.com/c/go/+/206337 in mind to only use the macOS load command for macOS binaries. |
@ianlancetaylor for cgo. It may be OK to specify the |
cc @thanm |
Change https://golang.org/cl/208268 mentions this issue: |
Confirmed that a toolchain built using the new 10.15 builder with Xcode installed and no changes to the min deployment target gets rid of the warning from
The issue may or may not affect notarization, since the min SDK version is still being set to 10.10 for the It may be fine to leave the target SDK version at the default (10.10) and not set it explicitly, but I worry about defaults changing down the road. |
This builder has Xcode installed instead of just the command-line tools. Because the SDKs are absent when just the command-line tools are installed, no base SDK version is being set in the go binary (it uses external linking) and codesign was printing a warning about library validation. Updating to use this builder gets rid of that warning. Updates golang/go#35459 Change-Id: Ib548c998042f499c2d57324e9a8746594ea7060d Reviewed-on: https://go-review.googlesource.com/c/build/+/208268 Run-TryBot: Andrew Bonventre <[email protected]> TryBot-Result: Gobot Gobot <[email protected]> Reviewed-by: Carlos Amedee <[email protected]>
Removing release-blocker label since the default value for the base SDK is 10.10 using the 10_15 Catalina builder. Keeping open to track setting this explicitly. |
Is that the only way to solve the problem by updating the Mac system ? @andybons |
@huoxingyun We've isolated what the fix would be and will be implementing it soon. |
Change https://golang.org/cl/215721 mentions this issue: |
'go get all' was run in this test without -d. This caused some std packages to be reinstalled if the test is run in a slightly different configuration than make.bash was run. run.bash would fail in some situations because of this. Nothing in the cmd/go tests should modify installed std or cmd packages. Updates #35459 Change-Id: Idd259a27d55502923b7fc54f361a77f0ac11eea2 Reviewed-on: https://go-review.googlesource.com/c/go/+/215721 Run-TryBot: Jay Conrod <[email protected]> TryBot-Result: Gobot Gobot <[email protected]> Reviewed-by: Michael Matloob <[email protected]>
Change https://golang.org/cl/215957 mentions this issue: |
Running the 'TestBuildForTvOS' test with CGO_CFLAGS set with certain values would cause the test to fail. all.bash would fail when CGO_CFLAGS was set to '-mmacosx-version-min=10.10' because the --macosx-version-min flag is incompatible with tvOS. The change guards against using an unintended flag in the unit test. Updates #35459 Change-Id: Ifc43f3ebfb23d37aabeaac2ea9efae5b877991bf Reviewed-on: https://go-review.googlesource.com/c/go/+/215957 Run-TryBot: Carlos Amedee <[email protected]> TryBot-Result: Gobot Gobot <[email protected]> Reviewed-by: Ian Lance Taylor <[email protected]>
Change https://golang.org/cl/216177 mentions this issue: |
Is there a solution to this issue? |
@cagedmantis What else is needed on this issue? Should the milestone be changed to 1.15? |
Change https://golang.org/cl/218598 mentions this issue: |
Change https://golang.org/cl/217057 mentions this issue: |
Change https://golang.org/cl/217059 mentions this issue: |
Change https://golang.org/cl/218597 mentions this issue: |
Change https://golang.org/cl/221100 mentions this issue: |
…tvOS test Running the 'TestBuildForTvOS' test with CGO_CFLAGS set with certain values would cause the test to fail. all.bash would fail when CGO_CFLAGS was set to '-mmacosx-version-min=10.10' because the --macosx-version-min flag is incompatible with tvOS. The change guards against using an unintended flag in the unit test. Updates #36846 Updated #35459 Change-Id: Ifc43f3ebfb23d37aabeaac2ea9efae5b877991bf Reviewed-on: https://go-review.googlesource.com/c/go/+/215957 Run-TryBot: Carlos Amedee <[email protected]> TryBot-Result: Gobot Gobot <[email protected]> Reviewed-by: Ian Lance Taylor <[email protected]> (cherry picked from commit ace25f8) Reviewed-on: https://go-review.googlesource.com/c/go/+/218598
…dwarf tests Running the dwarf tests with CGO_CFLAGS set with certain values would cause the test to fail. all.bash would fail when CGO_CFLAGS was set to '-mmacosx-version-min=10.10' because the --macosx-version-min flag is incompatible with some dwarf tests. The change guards against using an unintended flag in the unit test. Updates #36846 Updates #35459 Change-Id: Idc9b354aba44fdab424cb0081a4b3ea7a6d0f8e3 Reviewed-on: https://go-review.googlesource.com/c/go/+/216177 Run-TryBot: Carlos Amedee <[email protected]> TryBot-Result: Gobot Gobot <[email protected]> Reviewed-by: Jay Conrod <[email protected]> Reviewed-by: Ian Lance Taylor <[email protected]> (cherry picked from commit e948d2b) Reviewed-on: https://go-review.googlesource.com/c/go/+/217057
'go get all' was run in this test without -d. This caused some std packages to be reinstalled if the test is run in a slightly different configuration than make.bash was run. run.bash would fail in some situations because of this. Nothing in the cmd/go tests should modify installed std or cmd packages. Updates #36846 Updates #35459 Change-Id: Idd259a27d55502923b7fc54f361a77f0ac11eea2 Reviewed-on: https://go-review.googlesource.com/c/go/+/215721 Run-TryBot: Jay Conrod <[email protected]> TryBot-Result: Gobot Gobot <[email protected]> Reviewed-by: Michael Matloob <[email protected]> (cherry picked from commit 71bbffb) Reviewed-on: https://go-review.googlesource.com/c/go/+/218597 Run-TryBot: Carlos Amedee <[email protected]> Reviewed-by: Jay Conrod <[email protected]>
…s set Regression tests for #24161 use a macro to conditionally compile some stub definitions. The macro tests that the minimum macOS version is less than 10.12. We get duplicate definitions when building this test with CGO_CFLAGS=-mmacosx-version-min=10.x where 10.x < 10.12. With this change, we use a different macro, __MAC_OS_X_VERSION_MAX_ALLOWED__, which tests the SDK version instead of the minimum macOS version. This checks whether these definitions are present in headers. After this change, 'go tool dist test cgo_test' should pass with CGO_FLAGS=-mmacosx-version-min=10.10. Updates #36846 Updates #35459 Change-Id: I88d63601c94b0369c73c38d216a2d41ba7d4e579 Reviewed-on: https://go-review.googlesource.com/c/go/+/216243 Run-TryBot: Jay Conrod <[email protected]> Reviewed-by: Keith Randall <[email protected]> TryBot-Result: Gobot Gobot <[email protected]> (cherry picked from commit 1f9f88b) Reviewed-on: https://go-review.googlesource.com/c/go/+/217059 Run-TryBot: Carlos Amedee <[email protected]> Reviewed-by: Jay Conrod <[email protected]>
Set the minmacos version depending on the version of go being packaged for macOS releases. Removed support for Go 1.12 since it is no longer supported. Fixes golang/go#36846 Updates golang/go#35459 Change-Id: Ifb9a0296fde5ed87da72d7719a714744484cc7db Reviewed-on: https://go-review.googlesource.com/c/build/+/221100 Run-TryBot: Carlos Amedee <[email protected]> TryBot-Result: Gobot Gobot <[email protected]> Reviewed-by: Dmitri Shuralyov <[email protected]> Reviewed-by: Alexander Rakoczy <[email protected]>
What else needs to be done for this issue? |
I believe this is resolved now, but if anyone knows differently, please reopen. |
Indeed. The work for this has been done. Thanks for closing the issue. |
Change https://golang.org/cl/278435 mentions this issue: |
Change https://golang.org/cl/322629 mentions this issue: |
Instead, check that stale packages in the standard library are not rebuilt when already present in the build cache, and are not installed implicitly when rebuilt. We retain the staleness checks for the runtime package in tests involving '-i', because those are guaranteed to fail anyway if the package is stale and the "stale" failure message is arguably clearer. They can be removed if/when we remove the '-i' flag, but the runtime package is less likely to become stale because it does not have cgo dependencies. Fixes #46347 Updates #33598 Updates #35459 Updates #41696 Change-Id: I7b0a808addd930f9f4911ff53ded62272af75a40 Reviewed-on: https://go-review.googlesource.com/c/go/+/322629 Trust: Bryan C. Mills <[email protected]> Run-TryBot: Bryan C. Mills <[email protected]> TryBot-Result: Go Bot <[email protected]> Reviewed-by: Cherry Mui <[email protected]> Reviewed-by: Jay Conrod <[email protected]>
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]>
This is needed to ensure that Apple’s notarization service can check that the
go
binary is using (at minimum) the 10.9 SDK.Notice
Library validation warning=OS X SDK version before 10.9 does not support Library Validation
The SDK is not properly specified in the
go
binary:All other binaries built with the toolchain have the correct values:
The fix for this will likely need to be backported. Hopefully it’s simple. 🤞
Related issues:
The text was updated successfully, but these errors were encountered: