fix(android): bundle every ABI's _sysconfigdata into the ABI-common stdlib.zip#218
Open
FeodorFitsner wants to merge 2 commits into
Open
fix(android): bundle every ABI's _sysconfigdata into the ABI-common stdlib.zip#218FeodorFitsner wants to merge 2 commits into
FeodorFitsner wants to merge 2 commits into
Conversation
…tdlib.zip The pure stdlib.zip is built once from the primary ABI (abis.first(), e.g. arm64-v8a), but _sysconfigdata__<arch> is arch-specific: each ABI ships its own (e.g. _sysconfigdata__android_x86_64-linux-android) and CPython imports the one matching the running device at startup (sysconfig, pulled in by ctypes). So on a non-primary ABI (e.g. an x86_64 emulator) the embedded interpreter crashed with 'ModuleNotFoundError: No module named _sysconfigdata__android_x86_64-linux-android'. The primary splitStdlib task now also harvests every other ABI's stdlib/_sysconfigdata* from its libpythonbundle.so into stdlib.zip (depending on the other ABIs' untar and holding non-primary tasks until the primary has read their bundles).
FeodorFitsner
added a commit
to flet-dev/flet
that referenced
this pull request
Jun 26, 2026
…anch Temporarily override serious_python_android + serious_python_platform_interface to flet-dev/serious-python#218 (fix/android-x86_64-sysconfigdata) so the android x86_64 CI leg validates the fix end-to-end (embedded Python no longer crashes with ModuleNotFoundError: _sysconfigdata__android_x86_64-linux-android). Locally confirmed: pubspec.lock resolves to the branch and stdlib.zip now ships both aarch64 and x86_64 _sysconfigdata. Revert to the pub.dev release once #218 ships.
…id dup) The previous harvest matched stdlib/_sysconfigdata*, which also catches the generic, ABI-identical _sysconfigdata__linux_ that some Python versions (e.g. 3.12) ship in every ABI. The primary ABI already adds that via the stdlib loop, so re-adding it from a non-primary ABI threw 'java.util.zip.ZipException: duplicate entry: _sysconfigdata__linux_.pyc'. Match only the per-ABI _sysconfigdata__android_<arch> modules (unique per ABI), which is exactly what CPython imports on-device. Add CHANGELOG entry (4.1.1).
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.
Problem
The pure
stdlib.zipis ABI-common and built once from the primary ABI (abis.first(), e.g.arm64-v8a). But_sysconfigdata__<arch>is arch-specific: each ABI ships its own (e.g._sysconfigdata__android_x86_64-linux-android), and CPython imports the one matching the running device at startup (sysconfig._init_posix, pulled in byctypes).So on a non-primary ABI (e.g. an x86_64 emulator when arm64-v8a is primary) the embedded interpreter crashes on startup:
This was caught by Flet's new on-device
flet testCI running on an x86_64 Android emulator (passes on arm64 devices/emulators, where the primary ABI's sysconfigdata happens to match).Fix
The primary
splitStdlibtask now also harvests every other ABI'sstdlib/_sysconfigdata*from itslibpythonbundle.sointostdlib.zip— depending on the other ABIs' untar so their bundles exist to read, and holding non-primary tasks until the primary has read them (each task deletes its own bundle at the end).Validation
A patched APK build's
stdlib.zipnow contains both_sysconfigdata__android_aarch64-linux-android.pycand_sysconfigdata__android_x86_64-linux-android.pyc(previously only the aarch64 one).