Skip to content

Android Support - #35

Merged
beetlebugorg merged 3 commits into
mainfrom
feat/android
Jul 26, 2026
Merged

Android Support#35
beetlebugorg merged 3 commits into
mainfrom
feat/android

Conversation

@beetlebugorg

Copy link
Copy Markdown
Owner

No description provided.

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.
@beetlebugorg
beetlebugorg merged commit ad57a58 into main Jul 26, 2026
5 checks passed
@beetlebugorg
beetlebugorg deleted the feat/android branch July 26, 2026 17:21
@beetlebugorg
beetlebugorg restored the feat/android branch July 26, 2026 23:32
@beetlebugorg
beetlebugorg deleted the feat/android branch July 26, 2026 23:32
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.

1 participant