-
-
Notifications
You must be signed in to change notification settings - Fork 11
update to macOS 12 Monterey / latest Xcode version #15
Conversation
Signed-off-by: Stephen Gutekanst <[email protected]>
Signed-off-by: Stephen Gutekanst <[email protected]>
|
Thanks for this- I merged it to a different branch called I played with the data a bit and I have a proposal to support multiple macOS versions. First, the observations that I made from exploring the data: If we naively shipped all 3 versions of these headers, it would come out to 32.1 MiB installation size, which is more than I am comfortable with. So what can we do? Side note, the meld project is a really nice UI for exploring the diffs between directory trees. Anyway my observations are:
I have not run a program to measure exactly but I think if we had this scheme, we could ship multiple versions without adding too much to the installation size:
I've removed the C ABI component from the triple here for macOS because it is not meaningful. So how this works is that we have a script that takes in the data from this project, fetch-them-macos-headers, which contains an independent copy of the headers for every pair of {arch, version}. The script finds out which files are 100% in common between everything, and puts them in The Zig compiler's job, then is to pass One key feature of doing the compression scheme this way is that the zig compiler does not need to move files around on disk or involve a cache system; it is done entirely by making careful use of Alternative layer scheme:
This one has the only difference in layer 2, which has differences for versions but not architectures. It's not obvious to me which way of organizing the layers would be better; I think we should use the script to try both schemes and use the one that results in a smaller installation size. My hunch is that the alternative scheme will be better, due to observation number 2. |
|
I updated the script in d9d8958 and did the smallest amount I could to test out some results. I think the script is only capable of 2 layers without some more improvements, but the results are already promising: This totals 17 MiB which is within what I would consider to be the acceptable range. Introducing a Layer 2 should improve it more. This is compared to status quo master branch of Zig which has 7 MiB installation size: Also worth noting is that the @kubkon and @slimsag: what are your thoughts on this proposal? |
|
After mulling this around, I agree this is likely the best approach. In the future when the package manager distributes .tbd framework stubs, we will likely want to do the same thing. One thing that is unclear to me from your target triple examples above: what version does the target triple e.g. |
|
You can find the answer to this question programmatically by using |
|
@slimsag @andrewrk thanks so much for your work and input - it's very valuable! I'll take it over from here and hopefully finish the script so that it generates the desired 3-layer solution. I'll then move onto updating the zig's frontend to make use of this. In terms of the default, this really matters mainly for cross-compilation environments as when building natively, we fallback to the native sysroot (unless it's not there, that is; e.g., when the user didn't install either the CLT or Xcode). In cross-compilation environments, I think by default we should target the oldest supported macOS version which as far as I understand should run on every version above it - for x86_64 that'd be 10.5, and aarch64 11. The user will then have the option to opt in to any explicitly specified version provided it's one of the supported, latest 3 macOS releases. This will also be possible when compiling natively. Does that make sense, and would you agree? |
|
EDIT: Made a mistake in the code, here are corrected numbers again. Some prelim results for alternative layering: This scheme totals 14M, max per subdir is 3.5M as you can see. I'll now investigate alternative 1 where we create layer 2 based on architecture rather than OS version. |
|
SGTM also just to reiterate, I no longer have any immediate need for this change so if you're doing any of this on my behalf.. :D |
|
Results for alternative 1: Clearly, alternative 2 wins and by a lot. |
|
Merged in 46310be. |
fetch_them_macos_headers fetchfetch_them_macos_headers fetchI've also sent a PR to Zig here: ziglang/zig#10202 - we can keep discussion about if this is the right thing to do over there