Skip to content

Fix 16 KB alignment of published Android libraries - #7

Merged
lemcoder merged 1 commit into
masterfrom
fix/ci-ndk-16kb
Nov 4, 2026
Merged

lemcoder merged 1 commit into
masterfrom
fix/ci-ndk-16kb

Conversation

@lemcoder

@lemcoder lemcoder commented Nov 4, 2026 •

Copy link
Copy Markdown
Owner

Problem

The Android libraries in the published 0.4.0 and 0.4.1 AARs are 4 KB aligned (LOAD align 0x1000 for arm64-v8a and x86_64), so the 16 KB page fix from #3/#4 never reached Maven Central. Local builds were fine (0x4000), which is why it went unnoticed.

The publish log shows why: every Android library was built with ndk/27.3.13750724. GitHub's macOS (and Ubuntu) runners preset ANDROID_NDK_HOME to that NDK, and KonanPlugin ranks ANDROID_NDK_HOME above the Android Gradle plugin's NDK, so the NDK 28.2 the workflow installed was never used. NDK 27's linker defaults to 4 KB pages.

Fix

  • Both workflows install NDK 28.2 and point ANDROID_NDK_HOME at it.
  • New scripts/check-16kb-alignment.sh <aar> fails unless every 64-bit .so has 16 KB aligned LOAD segments.
  • The Test workflow builds the AAR and runs the check, so the required "Linux tests" check now gates alignment on every PR.
  • The Publish workflow runs the check before publishing, so a misaligned AAR can't reach Maven Central again.

Test plan

  • Script fails on the published 0.4.0 AAR, passes on a local NDK 28 build
  • CI on this PR: Linux tests + alignment check green

After merging, a 0.4.2 release fixes the published artifact.

🤖 Generated with Claude Code

GitHub's runners preset ANDROID_NDK_HOME to NDK 27.3, which KonanPlugin
prefers over the Android Gradle plugin's NDK, so the published 0.4.0 and
0.4.1 AARs were linked with 4 KB aligned segments despite the NDK 28
install. Both workflows now point ANDROID_NDK_HOME at NDK 28.2, and
scripts/check-16kb-alignment.sh fails the build, on every pull request
and before publishing, if a 64-bit library is not 16 KB aligned.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@lemcoder
lemcoder merged commit d886eb9 into master Nov 4, 2026
1 check 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.

1 participant