Repository navigation
fix(android): bundle libc++_shared.so — launch crash on every device - #71
Merged
Merged
Conversation
…ashed at launch
Root cause (v2.12.3 and every earlier APK): cpal's oboe audio backend is
C++, so libcapsuleos_native.so carries DT_NEEDED libc++_shared.so — but
cargo-ndk does not copy that runtime from the NDK and the APK shipped
without it. The loader resolves dlopen dependencies eagerly, so the
process died before a single line of Rust ran, on every device.
Diagnosed by auditing the released APK's ELF tables with a new pure-python
gate, scripts/check_apk_native_deps.py (no SDK needed):
- every DT_NEEDED of every packaged .so must be a system lib or be
packaged too (the v2.12.3 APK fails exactly here);
- PT_LOAD alignment must be 16384 (16 KB-page devices);
- ANativeActivity_onCreate must be exported.
Both android.yml and release.yml now copy libc++_shared.so from the NDK
sysroot into jniLibs after cargo ndk, and run the gate against the built
APK. The gate was validated locally: FAIL on the v2.12.3 release APK,
LAUNCH-READY on a fixed layout.
Also: versionCode was stuck at 1 since the first APK, so updates could
not install over old builds ('App not installed') — bumped to 2.
docs/android.md: current backend name (android-native-activity since
v2.12.0) and the libc++_shared story.
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.
Report
The Android app died instantly at launch on every device. Static ELF audit of the released v2.12.3 APK found the root cause:
lib/arm64-v8a/libcapsuleos_native.sohasDT_NEEDED libc++_shared.so(cpal's oboe audio backend is C++),libc++_shared.sois not among them.The loader resolves
dlopendependencies eagerly, so the process died before a single line of Rust ran. cargo-ndk builds the.sobut does not copy that C++ runtime from the NDK — that is the packaging gap.Everything else checked out and is now gated: PT_LOAD alignment is 16384 (16 KB-page devices),
ANativeActivity_onCreate/android_mainare exported, and the manifest/backend pair matches.Fix
android.ymlandrelease.ymlcopylibc++_shared.sofrom the NDK sysroot intojniLibsright aftercargo ndk.scripts/check_apk_native_deps.py(pure python, no SDK) runs against the built APK in CI: everyDT_NEEDEDof every packaged.somust be a system lib or packaged, alignment ≥ 16384, NativeActivity export present. Validated locally: FAIL on the v2.12.3 release APK (exact missing-lib case), LAUNCH-READY on a fixed layout.versionCodebumped from the permanently stuck1to2— without this, updates refused to install over old builds («App not installed»).docs/android.md: actual backend name and thelibc++_sharedstory.Verification
Type