From fefe22662662c8cdfcb97b5cdf95dbed68d657f0 Mon Sep 17 00:00:00 2001 From: giswqs Date: Sun, 15 Nov 2026 11:35:01 -0500 Subject: [PATCH] fix(mobile): reject an empty native-library alignment check --- apps/rustgis-mobile/build-apk.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/apps/rustgis-mobile/build-apk.sh b/apps/rustgis-mobile/build-apk.sh index 0cabf5db45..0f5dbb2186 100755 --- a/apps/rustgis-mobile/build-apk.sh +++ b/apps/rustgis-mobile/build-apk.sh @@ -96,7 +96,9 @@ strip=$(ls "$ANDROID_NDK_HOME"/toolchains/llvm/prebuilt/*/bin/llvm-strip | head find "$out/apk/lib" -name librustgis_mobile.so -exec "$strip" {} \; # Each segment aligned to 16 KB pages, which Android 15 phones may use and Google Play requires. readelf=$(ls "$ANDROID_NDK_HOME"/toolchains/llvm/prebuilt/*/bin/llvm-readelf | head -1) +checked=0 while IFS= read -r -d '' so; do + checked=$((checked + 1)) # In an assignment of its own, so a readelf that fails stops the script. info=$("$readelf" -lW "$so") for align in $(awk '$1 == "LOAD" { print $NF }' <<< "$info"); do @@ -106,6 +108,7 @@ while IFS= read -r -d '' so; do fi done done < <(find "$out/apk/lib" -name '*.so' -print0) +[ "$checked" -gt 0 ] || { echo "build-apk: no native libraries to check for 16 KB alignment" >&2; exit 1; } # The activity's Java half, compiled without Gradle: javac, then d8 to Android's bytecode. rm -rf "$out/java" && mkdir -p "$out/java/classes" "$out/java/dex"