Android Support - #35
Merged
Merged
Conversation
Zig ships no bionic headers, so the C deps (Lua, libtess2, nanosvg, stb) fail to find string.h/math.h/asm/* when targeting *-linux-android. Add a -Dandroid-ndk option that generates the Zig libc config from the NDK sysroot (include dir, the arch asm/ include in the triple subdir, and the per-API crt dir) and pins it to the lib artifact via setLibCFile — scoped to the lib so it doesn't disturb the host tools pinned to linux-musl (a global --libc does). zig build lib -Dtarget=aarch64-linux-android -Dandroid-ndk=$ANDROID_NDK Produces an ELF64 AArch64 libtile57.a. Native builds are unaffected (the libc file is null off-android).
androidLibcFile hard-coded darwin-x86_64; on other hosts (darwin-arm64 NDKs, linux) the sysroot path was wrong -> "stdio.h/assert.h file not found" when compiling the C deps. Probe the prebuilt/<host> dirs and pick the one that exists (via std.Io.Dir.accessAbsolute), falling back to the host-OS default.
The darwin-arm64-first probe could pick a nonexistent toolchain dir on some setups (accessAbsolute behaviour varies), yielding a bad sysroot -> "stdlib.h not found". Order candidates host-OS-default first (darwin-x86_64 — what the NDK ships, even on Apple silicon) and fall back to it, so the sysroot is correct regardless.
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.
No description provided.