From b3cdad0c75ef0930f60109de2a12429a46528615 Mon Sep 17 00:00:00 2001 From: Siavash Sameni Date: Tue, 7 Apr 2026 18:06:28 +0400 Subject: [PATCH] fix: copy libc++_shared.so from NDK when cargo-ndk skips it cargo-ndk doesn't always copy libc++_shared.so into jniLibs. The build script now finds it in the NDK and copies it manually if missing, preventing the build check from failing. Co-Authored-By: Claude Opus 4.6 (1M context) --- scripts/build-and-notify.sh | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/scripts/build-and-notify.sh b/scripts/build-and-notify.sh index aed8d4a..2d501d5 100755 --- a/scripts/build-and-notify.sh +++ b/scripts/build-and-notify.sh @@ -85,9 +85,19 @@ echo ">>> Rust build..." cargo ndk -t arm64-v8a -o android/app/src/main/jniLibs build --release -p wzp-android 2>&1 | tail -5 echo ">>> Checking .so files..." +# cargo-ndk may not copy libc++_shared.so — grab it from the NDK if missing +if [ ! -f android/app/src/main/jniLibs/arm64-v8a/libc++_shared.so ]; then + echo ">>> libc++_shared.so missing, copying from NDK..." + NDK_LIBCXX=$(find "$ANDROID_NDK_HOME" -name "libc++_shared.so" -path "*/aarch64-linux-android/*" | head -1) + if [ -n "$NDK_LIBCXX" ]; then + cp "$NDK_LIBCXX" android/app/src/main/jniLibs/arm64-v8a/ + echo "Copied from: $NDK_LIBCXX" + else + echo "WARNING: libc++_shared.so not found in NDK, APK may crash at runtime" + fi +fi ls -lh android/app/src/main/jniLibs/arm64-v8a/ [ -f android/app/src/main/jniLibs/arm64-v8a/libwzp_android.so ] || { echo "ERROR: libwzp_android.so missing!"; exit 1; } -[ -f android/app/src/main/jniLibs/arm64-v8a/libc++_shared.so ] || { echo "ERROR: libc++_shared.so missing!"; exit 1; } echo ">>> APK build..." cd android && chmod +x gradlew