Skip to content

Android: shared libraries built without 16KB page alignment fail Google Play #6345

@FeodorFitsner

Description

@FeodorFitsner

Problem

Google Play now requires all shared libraries (.so files) to be 16KB page-aligned (Android 15+). Apps built with Flet that include native Python dependencies fail this requirement because mobile-forge does not pass the -Wl,-z,max-page-size=16384 linker flag when cross-compiling for Android.

This affects all native .so libraries built by mobile-forge, not just specific packages.

Example from user report (#5607)

A Flet app using reportlab (which depends on Pillow) shows:

✗ libjpeg.so [arm64-v8a] → 4096 (CRITICAL)
✗ libturbojpeg.so [arm64-v8a] → 4096 (CRITICAL)
✗ libjpeg.so [x86_64] → 4096 (CRITICAL)
✗ libturbojpeg.so [x86_64] → 4096 (CRITICAL)

All other libraries (libpython, libfreetype, libcrypto, etc.) that come from python-build-standalone or are linked differently happen to be aligned, but any .so built by mobile-forge recipes without the flag will have 4096-byte alignment.

Solution

Two changes needed in mobile-forge:

  1. src/forge/build.py: Add -Wl,-z,max-page-size=16384 to LDFLAGS for Android builds. This automatically covers all autotools-based recipes (./configure && make) which respect LDFLAGS.

  2. CMake-based recipe build.sh files: CMake does not read LDFLAGS from the environment, so each CMake recipe that produces shared libraries needs -DCMAKE_SHARED_LINKER_FLAGS="$LDFLAGS" added to its Android cmake invocation. Affected recipes: flet-libjpeg, flet-libcrc32c, flet-libgeos, flet-libproj, flet-libgdal, flet-libpyjni.

Related

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

Status

🆕 New

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions