-
-
Notifications
You must be signed in to change notification settings - Fork 31.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bpo-30386: Add a build infrastructure for Android. #1629
Conversation
Mind also doing this for iOS as well so people can build their own free version of python for the iOS. It is annoying having to pay $$$ for 3.4+ on it but nothing for 2.7... Also what about pip on the android and iOS? I thought they might not get pip to work on them. |
Commit details can be found at issue bpo-30386. |
I did not request a review from tiran. |
…es from the external libraries
terminfo/l/linux is now again installed on the emulator.
See libffi/libffi#265. The external libraries are now untared in the build tree instead of the source tree previously.
This is at Android build-tools version 25.0.3 and emulator version 26.0.3.
@xdegaye is there some dedicated place to discuss about android ports since you are not on irc ? |
@pmp-p you can open a new issue on the issue tracker and if you want to involve me in the discussion just add |
Android/README.rst
Outdated
.. contents:: | ||
|
||
This document provides a quick overview of the Python build system for Android | ||
on a **linux platform** [1]_. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This documentation is uncomplete. You need "quick start" instructions to explain what is Android, what do I require on my local host, do I need a physical device, etc. This documentation mostly explains the implementation, not really how to use it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm trying to run Python on Android in an emulator using these recipes, but it's hard to understand how to use it. First, I downloaded NDK r16b but configure-android immediately fails because it requires NDK 14... This thing be very explicit in the doc, since the NDK is a big file (800 MB, so slow to download) and takes a lot of disk space (2.6 GB). It's not easy to install it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will add a quick start
section shortly.
First, I downloaded NDK r16b but configure-android immediately fails because it requires NDK 14.
I understand your frustation. The README does say that android-ndk-r14 is required
in a note and that note is referred to in each Requirements
section where the NDK is required. I will add a warning about this in the quick start
section unless you have a better idea.
When you're done making the requested changes, leave the comment: |
See .github/CODEOWNERS: some maintainers are automatically added depending which files are modified. |
I tried to use the recipe but I failed. There many traps:
I tried:
The compilation fails somewhere in setup.py about Tools/. I commented Tools in setup.py, then the compilation fails on building something about extensions:
|
Ah! This is caused by my setup.py hack. The correct patch is:
With this patch, I'm able to build Python:
Ok. Now what I am supposed to do? :-) |
My notes:
|
Hi, first thx for layout some android support. linux mint 18.3 : ANDROID_ARCH=armv7 ANDROID_API=21 restrictions of WITH_LIBRARIES="libffi" cause make install to fail because no .so get generated and build.mk tries to copy and package them ( libffi is static .a scripts looks for .so ). btw curses build fails with : ../ncurses/./tty/hardscroll.c:148:10: fatal error: 'curses.priv.h' file not found |
Sorry but you did it wrong :-(. To build Python for an emulator you must follow the So you follow these steps:
I think the |
@pmp-p Are you using the external libraries that are downloaded by the Makefile generated by |
yes & yes : here's full session, https://gist.githubusercontent.com/pmp-p/84e93c3e13943ea61e5a3493debf23de/raw/5696180869ccee445c47af9b07d0f3c67d8f6d6d/gistfile1.txt and if it can help to broad support, i tried cross compilation too for api-19 at the time of 3.7a2 i got repl, interpreter to embed /run panda3d both on H3Droid armv7 : here are some ugly patches https://github.com/pmp-p/h3droid/tree/sdk/usr/src/python3.7-android/patches |
Are you sure ?
|
( "BTW thanks for having me lose my time searching for this." Then please for god's sake don't make android support official if this is the kind of help or welcome we ( poor users) would get. ) Of course i am sure , i took the time to build a clean mint 18 pc to run the build side by side with victor he was building api-24 64bits, while me api-21 32bits. Parenthèses fermées j'espère. PS: by reviewing irc log, it appears Victor had it built for intel/amd, not arm like me maybe that's a clue |
This is the full build.log of a build that uses the same parameters as those used by @pmp-p. The differences with @pmp-p results are:
BTW still missing the build output of the other problem reported @pmp-p. |
"the origin of the readline source is unknown" it is always the case since you are using multiple external link .tar.gz without checking checksums. In some case that could be a concern at least for some devices and average system administrator. You are using ccache and may have curses-dev installed so i did the same, checked both using mawk/gawk => but problem was still there. For me it is quite simple : ncurses cross compile support is not as good as expected and need controlled environnement or a script of yours to help it. Sadly i tried on ubuntu flavor because that is what less than average unix developper is using nowadays. i'll post make install log failure when make depends step is fixed, as i adopted your script for a panda3d android build process : i'll try to investigate more. |
Well i upgraded my system recently, and the ncurses build problem is gone, so let's forget about it. But some questions arose ... CPython compiles fines with any ndk : only third parties have real trouble, so why introduce them ? Are you removing older api and other ndk just because you know some tests won't run ? As running/embedding/testing is a different problem and is not limited to "api-21 ndk-14 on friendly host" now i get it : that's not android platform support of any kind so i owe you an apology because i was confused about that ( maybe false hope ), I suggest you rename the title to "add a build infrastucture for 1 specific Android version where all third parties are not completely broken" and i wanted to thank you for your work it was very helpfull for a specific use case. |
sys.prefix must not be located on /sdcard: pip adds a sys.prefix/bin/ directory and fails upon PermissionError raised when using the /sdcard file system.
I just tested this PR for use with Kivy via python-for-android, something I've been meaning to do for a long time, and it worked very well. I was also able to get target API 27 with the latest NDK 17 working without too many issues, although I don't really understand why some things did seem to break. I found the python-dev mailing list posts about this but I'm not clear what is the current status of these efforts. Is this still the most up to date and active CPython for Android resource, or is there anything more recent, or likely to come soon? This PR already makes a superb base for improving python-for-android's Python 3 support, but I'd like to try to engage more with current developments if possible. |
@inclement |
Add a build infrastructure for Android to cross-compile Python using the Android NDK and allowing to run python interactively on the emulator or to run the Python test suite using the Android SDK.
https://bugs.python.org/issue30386