Skip to content

Fix Android native build#144

Closed
subham8907 wants to merge 5 commits into
bonede:mainfrom
subham8907:main
Closed

Fix Android native build#144
subham8907 wants to merge 5 commits into
bonede:mainfrom
subham8907:main

Conversation

@subham8907

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

@subham8907

Copy link
Copy Markdown
Contributor Author

@DavidBakerEffendi please merge

@subham8907 subham8907 closed this Apr 26, 2026
@DavidBakerEffendi

Copy link
Copy Markdown
Contributor

@DavidBakerEffendi please merge

I am not a maintainer of this repo

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