Repository navigation
ci(preview): use real macOS SDK for cross-compilation - #403
Merged
Merged
Conversation
-undefined dynamic_lookup defers symbol resolution to runtime but Zig's MachO linker still validates that the framework directory exists in the search paths before deferring. With no -F paths configured the linker rejects -framework CoreFoundation outright. Create a minimal CoreFoundation.tbd stub (empty exports, correct install-name) and add its parent dir via -F so the linker's framework- exists check passes. All actual CoreFoundation symbols resolve at runtime on real macOS where the framework is always present. Co-authored-by: Claude <noreply@anthropic.com> Signed-off-by: Alexey Zhokhov <alexey@zhokhov.com>
cargo-zigbuild cannot resolve Apple frameworks (CoreFoundation, etc.) without the actual SDK — Zig only ships C stdlib stubs, not framework stubs (ziglang/zig#1349). Fake TBD stubs are rejected by Zig's linker. Fix: download MacOSX15.5.sdk from joseluisq/macosx-sdks (~75 MB, cached between runs via actions/cache) and set SDKROOT. Zig passes SDKROOT as -isysroot to the linker, which resolves CoreFoundation and all other Apple frameworks from the real SDK framework stubs. Co-authored-by: Claude <noreply@anthropic.com> Signed-off-by: Alexey Zhokhov <alexey@zhokhov.com>
Co-authored-by: Claude <noreply@anthropic.com> Signed-off-by: Alexey Zhokhov <alexey@zhokhov.com>
MacOSX26.1.sdk defaults to macOS 26 minimum deployment target. Binaries built against it wouldn't run on macOS 12–25 without this. Setting 12.0 keeps the preview binary compatible with all reasonably modern macOS while still using the latest SDK for compilation. Co-authored-by: Claude <noreply@anthropic.com> Signed-off-by: Alexey Zhokhov <alexey@zhokhov.com>
donbeave
force-pushed
the
ci/macos-sdk-cross-compile
branch
from
May 20, 2026 01:40
1731238 to
e5aca32
Compare
donbeave
added a commit
that referenced
this pull request
Jun 7, 2026
## Summary Replaces fake TBD stub approach with the real macOS SDK from [joseluisq/macosx-sdks](https://github.com/joseluisq/macosx-sdks). **Root cause confirmed:** `cargo-zigbuild` cannot resolve Apple frameworks without the actual SDK — Zig only ships C stdlib stubs, not framework stubs ([ziglang/zig#1349](ziglang/zig#1349), still open). Fake `.tbd` stubs are either rejected or don't contain the symbol exports Zig's linker needs. **Fix:** Download `MacOSX15.5.sdk` (~75 MB compressed, cached via `actions/cache` keyed on SDK version) and set `SDKROOT`. Zig passes `SDKROOT` as `-isysroot` to the MachO linker, which resolves CoreFoundation and all other Apple frameworks from the real framework stubs in the SDK. This is the same approach used by Wails v3 for macOS cross-compilation from Linux. ## Hard-rule callout CI-only change. No schema, host-side, or user-visible changes. ## What's deferred Code-signing for macOS binaries — binary will not be signed, macOS Gatekeeper may prompt on first launch. Acceptable for developer-targeted preview. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Signed-off-by: Alexey Zhokhov <alexey@zhokhov.com> Co-authored-by: Claude <noreply@anthropic.com>
donbeave
added a commit
that referenced
this pull request
Jun 24, 2026
## Summary Replaces fake TBD stub approach with the real macOS SDK from [joseluisq/macosx-sdks](https://github.com/joseluisq/macosx-sdks). **Root cause confirmed:** `cargo-zigbuild` cannot resolve Apple frameworks without the actual SDK — Zig only ships C stdlib stubs, not framework stubs ([ziglang/zig#1349](ziglang/zig#1349), still open). Fake `.tbd` stubs are either rejected or don't contain the symbol exports Zig's linker needs. **Fix:** Download `MacOSX15.5.sdk` (~75 MB compressed, cached via `actions/cache` keyed on SDK version) and set `SDKROOT`. Zig passes `SDKROOT` as `-isysroot` to the MachO linker, which resolves CoreFoundation and all other Apple frameworks from the real framework stubs in the SDK. This is the same approach used by Wails v3 for macOS cross-compilation from Linux. ## Hard-rule callout CI-only change. No schema, host-side, or user-visible changes. ## What's deferred Code-signing for macOS binaries — binary will not be signed, macOS Gatekeeper may prompt on first launch. Acceptable for developer-targeted preview. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Signed-off-by: Alexey Zhokhov <alexey@zhokhov.com> Co-authored-by: Claude <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Replaces fake TBD stub approach with the real macOS SDK from joseluisq/macosx-sdks.
Root cause confirmed:
cargo-zigbuildcannot resolve Apple frameworks without the actual SDK — Zig only ships C stdlib stubs, not framework stubs (ziglang/zig#1349, still open). Fake.tbdstubs are either rejected or don't contain the symbol exports Zig's linker needs.Fix: Download
MacOSX15.5.sdk(~75 MB compressed, cached viaactions/cachekeyed on SDK version) and setSDKROOT. Zig passesSDKROOTas-isysrootto the MachO linker, which resolves CoreFoundation and all other Apple frameworks from the real framework stubs in the SDK. This is the same approach used by Wails v3 for macOS cross-compilation from Linux.Hard-rule callout
CI-only change. No schema, host-side, or user-visible changes.
What's deferred
Code-signing for macOS binaries — binary will not be signed, macOS Gatekeeper may prompt on first launch. Acceptable for developer-targeted preview.
🤖 Generated with Claude Code