android: the perils of upgrading Qt and rebasing p4a
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 8.6k
- Forks
- 3.5k
- Avg merge
- 2d 8h
- Merged PRs (30d)
- 61
Description
We should rebase our fork of python-for-android.
We are stuck on old versions of python (3.10, now 3.11) and openssl (1.1, already EOL).
Relatedly, we should also update Qt (from 6.4).
And the android NDK (from r23).
But everything is interwoven and tangled together.
Currently our p4a fork is based on the v2023.05.21 tag of upstream. Atm that's 2.5 years old. Though most of what we would want from p4a upstream has not been released yet - they haven't tagged a new release since v2024.01.21. I think that's not a serious problem -- we could just pick a recent commit.
Issues:
-
we need to adapt the GUI to styling changes in newer Qt (already in 6.5)
- we currently use Qt 6.4
-
@accumulator says, in QML, assignment of custom property types has issues since Qt>=6.6
- This would mean at least changing all types in the QML<->QObject boundary to a generic type.
- see https://www.riverbankcomputing.com/pipermail/pyqt/2024-June/045922.html
$ pip install --upgrade 'pyqt6==6.10.0' 'pyqt6-qt6==6.10.1' $ python3 ./assign-bug.py <Unknown File>:13:9: Unable to assign Simple to Simple$ pip install --upgrade 'pyqt6==6.5.3' 'pyqt6-qt6==6.5.3' $ python3 ./assign-bug.py // no issue
-
Qt restricts the android NDK version:
- Qt 6.4 -> NDK r23
- Qt 6.5 -> NDK r25 or r26 or r27
- Qt 6.8 -> NDK r26 or r27
-
p4a restricts the NDK version:
- current min of upstream is r25
- by default they use r28c
- so presumably upstream p4a supports at least the 25-28 range
-
currently we are using an unreleased google canary build of NDK r23d-canary,
as a hack to be able to compile with 16 KB page sizes (Google Play requirement)- see https://github.com/spesmilo/electrum/pull/10148
- note that newer p4a satisfies the 16 KB page size requirement by simply using the MUCH newer NDK r28
-
current upstream p4a supports
- cpython 3.14
as opposed to our current 3.10- EDIT: bumped to 3.11
- openssl 3.3
as opposed to our current 1.1.1w- found workaround to upgrade openssl to 3.0.x
- cpython 3.14
-
we are stuck on
cryptography==2.8, as building newer versions requires Rust- upstream p4a seems to have a solution
- though note that just because they have something that builds, it might not be reproducible (we would need to test that)
- this old version of cryptography is not compatible with OpenSSL 3.0+
- as workaround, we could switch to using
pycryptodomexinstead- for all our direct
cryptographyusage, it is almost a drop-in replacement - see https://github.com/spesmilo/electrum/pull/10332
- however note that some hw-wallet libs require
cryptographyand @accumulator has some branches with experimental hww support on Android
- for all our direct
- upstream p4a seems to have a solution
I think what we should try to do is:
-
step 1. upgrade Qt to 6.5
- adapt our qml gui to the styling changes
- upgrade the android NDK to r25
- r25 is supported by both Qt 6.5 and our current p4a fork
- there should be an unofficial google canary build of r25 that supports 16 kb page sizes, similar to our current hack for r23
-
step 2. rebase our p4a fork on current upstream
develop- upgrade the android NDK to r27
- r27 is supported by both Qt 6.5 and p4a upstream
- due to the rebase, inherit upgrade of python to 3.14 and openssl to 3.3
- upgrade the android NDK to r27
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with contrib/android/p4a_recipes/python3/init.py and contrib/android/p4a_recipes/openssl/init.py, then compare the fork at commit 003451604321deb1f10d879b63450ec76db4a758 with upstream p4a develop. Check the Qt/QML boundary and the Android build configuration while working through the proposed Qt 6.5 and NDK changes. Done means the fork is rebased, the Android build succeeds, and the required QML and dependency updates work together.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- android, python
- Domain
- build-system, mobile-dev
- Issue type
- Refactor
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100