You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
ability to link against darwin frameworks (such as CoreFoundation) when cross compilingΒ #1349
changed the title [-]Darwin: Best way to link against CoreFoundation[/-][+]ability to link against darwin frameworks (such as CoreFoundation) when cross compiling[/+]on Jul 2, 2019
Zig, and zig ld in particular, has the ability to link against frameworks when cross-compiling, however, a copy of the Darwin's sysroot (also called the SDK) is not bundled with Zig installation, therefore it is necessary to provide Zig valid paths to the sysroot and any search directories that may be required.
@kubkon I suspect the answer to this will be "Copy it from a Mac" but...
Any hints on where to get a sysroot bundle for MacOS?
If the answer is copy it, do you know where I can get a list of what bits I need to grab?
You can get macOS 12 SDK from Hexops for example. If you are looking for an older SDK version, you can get it here. In general tho, if you have a Mac, you just need to grab whatever xcrun --sdk macosx --show-sdk-path. Finally, there is also this website I am aware of but downloading the SDKs may require an active Apple Developer account: xcodereleases.com.
Reacted by Alberto Cavalcante and Pavel Perestoronin
Activity
andrewrk commentedon Aug 7, 2018
Here's what we need to accomplish:
extern "libname"syntax.[-]Darwin: Best way to link against CoreFoundation[/-][+]ability to link against darwin frameworks (such as CoreFoundation) when cross compiling[/+]kubkon commentedon Feb 2, 2022
Zig, and
zig ldin particular, has the ability to link against frameworks when cross-compiling, however, a copy of the Darwin's sysroot (also called the SDK) is not bundled with Zig installation, therefore it is necessary to provide Zig valid paths to the sysroot and any search directories that may be required.A typical invocation may look as follows,
hardillb commentedon Dec 8, 2022
@kubkon I suspect the answer to this will be "Copy it from a Mac" but...
Any hints on where to get a sysroot bundle for MacOS?
If the answer is copy it, do you know where I can get a list of what bits I need to grab?
kubkon commentedon Dec 8, 2022
You can get macOS 12 SDK from Hexops for example. If you are looking for an older SDK version, you can get it here. In general tho, if you have a Mac, you just need to grab whatever
xcrun --sdk macosx --show-sdk-path. Finally, there is also this website I am aware of but downloading the SDKs may require an active Apple Developer account: xcodereleases.com.shepherdjerred commentedon Feb 28, 2023
I got zig to cross-compile targeting aarch64 macOS on a Ubuntu Jammy host.
sdkcontains a macOS SDK. Instructions on doing this can be found on the osxcross project. I packaged the SDK, and then unzipped it intosdkDockerfile:
fix(deps): replace chrono with time to fix macOS cross-compilation
ci(preview): use real macOS SDK for cross-compilation instead of stubs
ci(preview): use real macOS SDK for cross-compilation (#403)
ci(preview): use real macOS SDK for cross-compilation (#403)
ci(preview): use real macOS SDK for cross-compilation (#403)