Skip to content

lean-deps: strip system_sdk, use explicit paths for system dependencies - #56

Closed
nat3Github wants to merge 6 commits into
zig-gamedev:mainfrom
nat3Github:main
Closed

nat3Github wants to merge 6 commits into
zig-gamedev:mainfrom
nat3Github:main

Conversation

@nat3Github

@nat3Github nat3Github commented Sep 4, 2026 •

Copy link
Copy Markdown

bundling macos sdks is illegal and bad practice because it leads to duplication in bigger software projects.
see david-vanderson/dvui#975

this PR enables cross compiling via --sysroot approach (for linux, mac)

@nat3Github
nat3Github marked this pull request as draft September 4, 2026 23:37
Zig strips the leading / off an absolute -L path when --sysroot is set
and rejoins it onto the sysroot, so passing sysroot+"/usr/lib" caused
a doubled path and 'unable to find dynamic system library objc'.
Passing "/usr/lib" as-is lets Zig's own join land correctly.

Also error out early with a clear message when cross-compiling to
macOS without --sysroot, instead of failing deep in the linker.

Verified with zig 0.14.0 and 0.16.0 for aarch64-macos, x86_64-macos,
and native (no sysroot).
@nat3Github
nat3Github marked this pull request as ready for review September 6, 2026 07:40
@hazeycode

Copy link
Copy Markdown
Member

Hi. I'd like to delete system_sdk repo entirely if possible. From what you've said, simple removing the dependency on it doesn't mean that we stop breaking the law, we'd have to delete the Apple stuff from that repo right? Also why have you deleted the CI script?

@nat3Github

Copy link
Copy Markdown
Author

sorry about the ci script, not really sure why i deleted it, ill reset and push after testing that sysroot cross-compiling works again!

we'd have to delete the Apple stuff from that repo right?

yes it would be good to consider that, since you are hosting it.

Registers the cross-path options unconditionally in build(), adds
-Dsystem_framework_path, and uses them on macOS instead of b.sysroot (dropping
the cwd_relative "/usr/lib" workaround that only existed because --sysroot
re-roots absolute -L paths).

--sysroot is graph-wide: it also reaches native host-tool steps in the same build
graph and re-roots every absolute -L onto itself. Plain build options let the
paths go only to the cross compile/link step.

Claude-Session: https://claude.ai/code/session_0172xcFVWUqrMeXfDPoyi3V2
@nat3Github
nat3Github marked this pull request as draft September 10, 2026 13:38
@nat3Github nat3Github changed the title lean-deps: strip system_sdk, use system frameworks/--sysroot, drop CI lean-deps: strip system_sdk, use explicit paths for system dependencies Sep 10, 2026
…ath/-Dframework_path/-Dlibrary_path

Drop the redundant 'system_' prefix from the include/framework flag names so
all three cross-compile options are named consistently (library_path already
had no prefix). Local identifiers keep the 'system_' prefix for legibility
(e.g. const system_library_path = b.option(..., "library_path", ...)).

Claude-Session: https://claude.ai/code/session_0172xcFVWUqrMeXfDPoyi3V2
@nat3Github nat3Github closed this Oct 11, 2026
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.

2 participants