libredirect: build fat library for x86_64, arm64, arm64e on darwin#153441
libredirect: build fat library for x86_64, arm64, arm64e on darwin#153441veprbl merged 1 commit intoNixOS:stagingfrom
Conversation
2b0a700 to
3795d33
Compare
What do you mean by that? It builds on Hydra: |
that is |
Getting a cached build from hydra works (well, "works", it pulls the binary from cache...) trying to force a build on the above machine: |
|
That's much better! I got confused why it didn't like my |
|
@veprbl thanks! I'll run some validation on a few aarch64-darwin machines. |
3795d33 to
5ac7fb5
Compare
|
@veprbl alright, I've finally managed to find the incantation to make this build with the nixpkgs provided tools. And I've also learned that we can use |
d8086cf to
ac49b41
Compare
|
@veprbl hope this is good to go now. I did rebase onto staging, and now it appears I have to rebuild the world again. Sigh. |
macOS's dyld can be rather picky as to what dylib it accepts. This even changes across macOS versions. Therefore we now build a fat dylib with all three architectures (x86_64, arm64, arm64e). This should then be compatible with pretty much any macOS's dyld.
ac49b41 to
a655bc0
Compare
|
This will need a backport to 21.11 |
|
@veprbl ping |
|
@veprbl who can merge this? I don't seem to be able to. |
Currently only members of the "Nixpkgs committers" group can merge PRs. I wanted to leave this open for a day to see if there will be any additional comments. Note that this will have to go through the staging process before it lands on master, which may take another 3 to 4 weeks. |
|
Yes. I'm aware that this will take quite some time. I just don't want to have to maintain my custom nixpkgs-21.11-darwin branch any longer than absolutely necessary. |
|
Successfully created backport PR #153917 for |
|
Out of curiousity, why does this library need to be fat? |
|
@Ericson2314 so depending on the macOS version you end up on, and we don't really have control over the macOS version the end user ends up using, So we'd better build a fat library with all slices, to insulate us from the underlying system changing requirements in dyld. This did build flawlessly on an old BigSur revision, that nixOS builders run. It failed on more recent BigSur builder and Monterey builders that my hydra runs, as they expect different architectures (most likely arm64e; however I also believe that BigSurs dyld has a bug in which non-far dylibs are erroneously rejected). |
|
@angerman is that true for any library, or is this library somehow special? |
|
@Ericson2314 so I haven't played much with |
|
Oh I see, the issue is that is messing with dyld itself with how it works? and due to Rosetta and other things need to cope with dyld being different arches? |
|
@Ericson2314 it's more like the It appears as:
So I've opted to just go for all possible architectures to cover all our bases here. |
|
OK. So perhaps x86_64 doesn't matter as rosetta stuff doesn't come into play but whatever, once were are doing fat-binary stuff might as well go all in. Thanks for explaining to me. |
libredirectcurrently fails to build on macOS machines. I've tried various combinations of BigSur and Monotery, it fails everywhere.Our llvmPackages_13.clang doesn't seem to like being forced to create tiple arch files. So we'll resort to the system clang on darwin for now. This item is so fundamentally intwined with the impure state of the host system (dyld) over which we have no control, that I find this "hack" to be acceptable, while ugly.
/cc @thefloweringash @Ericson2314