Skip to content

Fix Android native build#146

Merged
bonede merged 1 commit into
bonede:mainfrom
subham8907:main
Apr 30, 2026
Merged

Fix Android native build#146
bonede merged 1 commit into
bonede:mainfrom
subham8907:main

Conversation

@subham8907

@subham8907 subham8907 commented Apr 26, 2026

Copy link
Copy Markdown
Contributor

Summary

  • use the Android NDK compiler for Android native targets instead of Zig's Android target
  • add -fPIC for shared library builds
  • include the generated aarch64-linux-android-tree-sitter.so resource

Why

The current aarch64-linux-android build fails through Zig 0.11 because the Android libc/sysroot is not resolved correctly, producing missing standard C type and header errors such as size_t, NULL, and inttypes.h.

Routing Android builds through the installed Android NDK matches normal JNI build behavior and resolves the sysroot/header issue.

Validation

ANDROID_HOME=/Users/subhammahesh/Library/Android/sdk ./gradlew :tree-sitter:buildNative -PtreeSitterTargets=aarch64-linux-android --stacktrace

Result:

BUILD SUCCESSFUL

The generated artifact was verified as an ARM64 Android-compatible shared object:

tree-sitter/src/main/resources/lib/aarch64-linux-android-tree-sitter.so: ELF 64-bit LSB shared object, ARM aarch64

@bonede @DavidBakerEffendi

@bonede
bonede merged commit 343be96 into bonede:main Apr 30, 2026
6 of 10 checks passed
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