Skip to content

macos: improved SDK detection and linker integration with _mh_execute_header #10226

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

Merged
merged 4 commits into from
Nov 26, 2021

Conversation

kubkon
Copy link
Member

@kubkon kubkon commented Nov 26, 2021

If Zig didn't detect native SDK, always use shipped libc headers when targeting macOS.

Fixes #10217

cc @slimsag

EDIT: Turns out this PR leads naturally to a fix of another long-standing issue, so I've now converged the two, one on top of the other.

Changes / fixes:

cc @andrewrk @slimsag

If Zig didn't detect native SDK, always use shipped libc headers
when targeting macOS.
Since we are already detecting the path to the native SDK,
if available, also fetch SDK's version and route that to the linker.
The linker can then use it to correctly populate LC_BUILD_VERSION
load command.
@kubkon kubkon changed the title macos: always use Zig shipped libc headers when no native SDK macos: fix 10217 and 1982 Nov 26, 2021
On a bare macOS, when there is no CLT/Xcode installed, do not
trigger the CLT installation popup when building with zig cc.
Copy link
Member

@andrewrk andrewrk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent work! Super sweet fix with _mh_execute_header!

@andrewrk andrewrk changed the title macos: fix 10217 and 1982 macos: improved SDK detection and linker integration with _mh_execute_header Nov 26, 2021
@andrewrk andrewrk merged commit 7c2cc45 into master Nov 26, 2021
@andrewrk andrewrk deleted the fix-10217 branch November 26, 2021 20:00
@emidoots
Copy link

Works beautifully, thanks @kubkon !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants