Skip to content

Conversation

@StanislavNikolov
Copy link

@StanislavNikolov StanislavNikolov commented Jun 14, 2023

Discussed here: #15963

@StanislavNikolov
Copy link
Author

If you get a build of zig from the CI (running older macOS version) and just add this file, zig works correctly. Sadly, this patch is not enough to make zig build itself. There are many errors for missing header files, like `sys/cdefs.h'.

$ cp -r /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk//usr/include/ lib/libc/include/any-macos-any

fixes the issue, but adds hundreds of files to the repo. I don't know how it was decided which headers to be added to the repo, so someone with more expertise should probably review this.

@kubkon
Copy link
Member

kubkon commented Jun 16, 2023

Thanks for the PR! Please note that our policy is to add the headers/libsystem stabs when Apple releases the OS for general use, plus it should be initiated by a core team member as it requires more than adding a new libSystem.tbd stab file. I have now converted #15963 into a tracking issue and will be closing this PR.

@kubkon kubkon closed this Jun 16, 2023
@saagarjha
Copy link

Have you considered changing this policy? I'm just stopping by as an outsider but I will put forth that requiring everyone who is doing bringup of software for the new OS to carry patches is somewhat annoying. I understand not wanting provide official support for an OS that has not been released yet, but I personally find that one of the best ways to evolve on support for a new OS is to just start carrying the code for it and having people report issues as they encounter them.

@kubkon
Copy link
Member

kubkon commented Jun 18, 2023

Have you considered changing this policy? I'm just stopping by as an outsider but I will put forth that requiring everyone who is doing bringup of software for the new OS to carry patches is somewhat annoying. I understand not wanting provide official support for an OS that has not been released yet, but I personally find that one of the best ways to evolve on support for a new OS is to just start carrying the code for it and having people report issues as they encounter them.

I apologise for this inconvenience but we are simply stretched too thin as it is to even consider doing this at this time. Once we stabilise the language and the compiler however (i.e., not sooner than by 1.0 release), I am happy to revisit this.

@andrewrk
Copy link
Member

andrewrk commented Jun 18, 2023

I think one thing that would help users in this case is if it was more clear how to compile natively using system headers and system .tbd files rather than using zig's bundled installation data. I believe Zig already supports this but you have to pass --sysroot. This seems like a better thing for users to do in the meantime than to attempt to patch in the new headers & linker information.

@kubkon
Copy link
Member

kubkon commented Jun 18, 2023

I think one thing that would help users in this case is if it was more clear how to compile natively using system headers and system .tbd files rather than using zig's bundled installation data. I believe Zig already supports this but you have to pass --sysroot. This seems like a better thing for users to do in the meantime than to attempt to patch in the new headers & linker information.

That's a very good point. Perhaps we should create a wiki page outlining this?

@haze
Copy link
Contributor

haze commented Jun 20, 2023

I think one thing that would help users in this case is if it was more clear how to compile natively using system headers and system .tbd files rather than using zig's bundled installation data. I believe Zig already supports this but you have to pass --sysroot. This seems like a better thing for users to do in the meantime than to attempt to patch in the new headers & linker information.

is there a reason why zig doesn't try and detect if a sysroot is available and use those definitions over the bundled ones? I wouldn't mind submitting a PR enabling that behavior.

@andrewrk
Copy link
Member

I am in favor of that change, as long as the use case where Zig still works without XCode installed on supported OS versions is preserved.

@kubkon
Copy link
Member

kubkon commented Jun 20, 2023

I am in favor of that change, as long as the use case where Zig still works without XCode installed on supported OS versions is preserved.

Oh, we used to do that and then we decided not to do that, but as far as I am concerned we could go back to doing that. 😅

Anyhow, if y'all don't mind, I'd like to handle this one in order to ensure there are no unforeseen problems down the line.

@kubkon
Copy link
Member

kubkon commented Jun 20, 2023

Patch submitted in #16112. Anyone on latest macOS (Sonoma) beta, if you could have a go and lemme know if this fixes sysroot detection issues for you, that'd be great.

cc @haze @andrewrk

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants