diff --git a/CMakePresets.json b/CMakePresets.json index bff1ea339..1fd359818 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -295,6 +295,8 @@ "ANDROID_ABI": "arm64-v8a", "ANDROID_PLATFORM": "android-29", "ANDROID_STL": "c++_shared", + "CMAKE_SHARED_LINKER_FLAGS": "-Wl,-z,max-page-size=16384 -Wl,-z,common-page-size=16384", + "CMAKE_EXE_LINKER_FLAGS": "-Wl,-z,max-page-size=16384 -Wl,-z,common-page-size=16384", "SAGE_USE_DX8": "OFF", "SAGE_USE_SDL3": "ON", "SAGE_USE_OPENAL": "ON", diff --git a/cmake/meson-arm64-android-cross.ini.in b/cmake/meson-arm64-android-cross.ini.in index 28d75895e..cbf4983aa 100644 --- a/cmake/meson-arm64-android-cross.ini.in +++ b/cmake/meson-arm64-android-cross.ini.in @@ -31,5 +31,8 @@ endian = 'little' [built-in options] c_args = [] cpp_args = [] -c_link_args = [] -cpp_link_args = [] +# 16 KB ELF page alignment. Android 15+ ships (and Google Play requires, since +# Nov 2025) a 16 KB-page kernel; a 4 KB-aligned .so triggers a system "not +# 16 KB compatible" warning on install and fails to load on a real 16 KB device. +c_link_args = ['-Wl,-z,max-page-size=16384', '-Wl,-z,common-page-size=16384'] +cpp_link_args = ['-Wl,-z,max-page-size=16384', '-Wl,-z,common-page-size=16384'] diff --git a/scripts/build/android/build-adrenotools.sh b/scripts/build/android/build-adrenotools.sh index d1ef6ad38..6b85bf910 100755 --- a/scripts/build/android/build-adrenotools.sh +++ b/scripts/build/android/build-adrenotools.sh @@ -43,6 +43,7 @@ cmake -S "${SRC_DIR}" -B "${BUILD_DIR}" -G Ninja \ -DANDROID_ABI=arm64-v8a \ -DANDROID_PLATFORM="android-${ANDROID_PLATFORM}" \ -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_SHARED_LINKER_FLAGS="-Wl,-z,max-page-size=16384 -Wl,-z,common-page-size=16384" \ -DBUILD_SHARED_LIBS=ON echo "==> Building"