This is an experimental set of build scripts that will cross-compile the latest Python 3 git master for an Android device.
Building requires:
- Linux or macOS. Ubuntu 14.04, Arch Linux and macOS Sierra tested.
- Android NDK r16 beta 2 installed and environment variable
$ANDROID_NDKpoints to its root directory. NDK r14 or r15 may work yet not fully tested. NDk r13 or below is not supported. - git and python3.8 in $PATH. It's recommended to use the latest git-master to build python3.8. Here are some ways to install the python3.8:
- For Arch Linux users, install python-git package from AUR
- For Homebrew users, run
brew install python3 --HEAD - For MacPorts users, add my MacPorts overlay to
sources.confand runsudo port install python37 - For other users, install 3.8 from pyenv
Running requires:
- Android 5.0 (Lollipop, API 21) or above
- arm, arm64, x86 or x86-64
- A
busyboxbinary at /data/local/tmp/busybox
make cleanfor good measure.- For every API Level/architecture combination you wish to build for:
- Edit
envto match your (desired) configuration. maketo build everything!
- Edit
- Make sure
adb shellworks fine bash ./devscript/send.shcopies all files to/data/local/tmp/python3on the device- In adb shell:
cd /data/local/tmp . ./python3/tools/env.sh python3.8m
And have fun!
SSL certificates have old and new naming schemes. Android uses the old scheme yet the latest OpenSSL uses the new one. If you got CERTIFICATE_VERIFY_FAILED when using SSL/TLS in Python, you need to generating certificate names of the new scheme:
python3.8m ./python3/tools/c_rehash.py
Check SSL/TLS functionality with:
python3.8m ./python3/tools/ssl_test.py
No big issues! yay