Re: [Python-Dev] Cross compiling Python (for Android)
Frank, Matthew I matthew.i.frank at intel.com writes: 4. Module _decimal is failing to compile. The problem is that it has a header called memory.h. Android's libc has the problem that /usr/include/stdlib.h includes memory.h. But the build system puts -I. on the include path before the system dirs (as it should) so when compiling _decimal, Modules/_decimal/libmpdec/memory.h gets found instead of /usr/include/memory.h. Shiz has a patch here: https://github.com/rave-engine/python3-android/blob/master/mk/python/3.3.5/p\ ython-3.3.5-android-libmpdec.patch (which renames memory.h - mpmemory.h) but I don't know a. Is there a tracker for this yet? and b. Is Shiz's fix the desired one or should I be looking for another approach? (Maybe modifying the -I flags for the build of just the build of _decimal or something?) I think using memory.h in an application is standard conforming. Since _decimal compiles on all other Linux platforms, it may be worth reporting this to the Android developers and see if they can fix it (possibly by not including memory.h in stdlib.h). FWIW, OCaml also has a memory.h header. Stefan Krah ___ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
Re: [Python-Dev] Cross compiling Python (for Android)
Hi Frank, Nobody has responded to you yet, but don't feel discouraged by that! The core Python development group consists mostly of people who don't develop mobile apps in their day jobs, and they may feel reluctant to maintain changes that they can't personally test. (And I don't expect it would be easy to set up Android or iOS buildbots either.) But there are definitely people trying to use Python to develop mobile apps (e.g. Kivy). Today there was a similar post to python-ideas about this. I think the world may soon be eager to develop mobile apps in Python (the platforms are maturing and the processors are getting faster), and Python should be ready for this change in attitude. Hopefully we can get some good patches in for the next bugfix releases of Python 2.7 and 3.4, as well as the upcoming 3.5 alphas and betas. Of course, the Kivy approach might work for some time yet (they have a set of patches for Python 2.7.1 or 2.7.2), but it would be better if that wasn't necessary, and Python could be build (with the right dev environment) for iOS and Android. A word of advice: the specific patches you have should probably be submitted to the Python issue tracker (bugs.python.org). Also, several smaller patches are more likely to be reviewed and checked in timely than one mega-patch. Good luck! --Guido On Thu, Oct 23, 2014 at 12:22 PM, Frank, Matthew I matthew.i.fr...@intel.com wrote: This email is about my experience getting CPython (3.4.1) to cross-compile and run on x86 Android (4.4.2 with sdk 19 and ndk-r9). I know that Android is not a supported architecture (and I won't regale you with stories about the complete locale and mbstowcs support I had to borrow from FreeBSD to get it working). The purpose of this email is that several things I found are arguably bugs in the Python build system or code when it comes to cross-compiling that are exposed by Android's poor Posix support. I'd like some advice about what kind of patch (if any) would be most suitable for fixing the problems on the Python side. Just to be complete: I'm configuring with CPPFLAGS=-I../my-locale ../Python-3.4.1/configure --enable-shared --prefix=/path/to/install/dir --build=x86_64-linux-gnu --host=i686-linux-android --disable-ipv6 ac_cv_file__dev_ptmx=no ac_cv_file__dev_ptc=no ac_cv_little_endian_double=yes (The CPPFLAGS addition is to get the headers for my locale fixes instead of the default Android ones. ac_cv_file__dev_ptmx=no and ac_cv_file__dev_ptc=no are because I don't have /dev/whatever on my build machine. ac_cv_little_endian_double is because configure for cross builds can't figure out the endianness of doubles on the host (because it is running on the build machine not the host.) (For ARM it would be ac_cv_mixed_endian_double=yes.) I've gotten to the point where `make; make install` succeeds up to the point of building something that runs on my Android system (from the command line) and `python -m test` runs 388 tests, with 321 ok, 24 test failures and 43 tests skipped (the skips mostly due, I think, to me not yet having installed the right cross-building support for things like bz2 and dbm.) 1. `make` succeeds but `make install` always fails at the end with something having to do with being unable to run ensurepip (presumably because ensurepip requires modules that only run on the host, not the build module.) So it seems this should be wrapped in a test for cross compilation, but I haven't looked at exactly what yet. The error is: /linux-python/bin/python3.4: Error while finding spec for 'ensurepip.__main__' (class 'ImportError': /build-directory/build/lib.linux-i686-3.4/time.cpython-34m.so: wrong ELF class: ELFCLASS32); 'ensurepip' is a package and cannot be directly executed make: *** [install] Error 1 2. setup.py is missing -lm flag for several modules. On Linux this problem is hidden because libm is already loaded by the executable calling dlopen(), but Android's loader deals with unknown symbols differently (searches only the libs explicitly linked against the module being loaded.) http://bugs.python.org/issue21668 reports the problem for selectmodule (can't find ceil()) and timemodule (fmod() and floor()). But there are at least two more: audioop fails to load because it needs floor() and ctypes_test fails to load because it needs sqrt(). I'll happily update the patch in 21668. Is there any fundamental objection to adding the -lm flag to the link step where it is necessary? 3. What is ossaudiodev? It tries to include sys/soundcard.h, which I don't have on my system. (The rule in setup.py is wrapped in a test for host of Linux/FreeBSD/Darwin, but Android x86 gets configured with --host=i686-linux-android so to turn it off requires an extra test for and not cross_compiling.)
[Python-Dev] Cross compiling Python (for Android)
This email is about my experience getting CPython (3.4.1) to cross-compile and run on x86 Android (4.4.2 with sdk 19 and ndk-r9). I know that Android is not a supported architecture (and I won't regale you with stories about the complete locale and mbstowcs support I had to borrow from FreeBSD to get it working). The purpose of this email is that several things I found are arguably bugs in the Python build system or code when it comes to cross-compiling that are exposed by Android's poor Posix support. I'd like some advice about what kind of patch (if any) would be most suitable for fixing the problems on the Python side. Just to be complete: I'm configuring with CPPFLAGS=-I../my-locale ../Python-3.4.1/configure --enable-shared --prefix=/path/to/install/dir --build=x86_64-linux-gnu --host=i686-linux-android --disable-ipv6 ac_cv_file__dev_ptmx=no ac_cv_file__dev_ptc=no ac_cv_little_endian_double=yes (The CPPFLAGS addition is to get the headers for my locale fixes instead of the default Android ones. ac_cv_file__dev_ptmx=no and ac_cv_file__dev_ptc=no are because I don't have /dev/whatever on my build machine. ac_cv_little_endian_double is because configure for cross builds can't figure out the endianness of doubles on the host (because it is running on the build machine not the host.) (For ARM it would be ac_cv_mixed_endian_double=yes.) I've gotten to the point where `make; make install` succeeds up to the point of building something that runs on my Android system (from the command line) and `python -m test` runs 388 tests, with 321 ok, 24 test failures and 43 tests skipped (the skips mostly due, I think, to me not yet having installed the right cross-building support for things like bz2 and dbm.) 1. `make` succeeds but `make install` always fails at the end with something having to do with being unable to run ensurepip (presumably because ensurepip requires modules that only run on the host, not the build module.) So it seems this should be wrapped in a test for cross compilation, but I haven't looked at exactly what yet. The error is: /linux-python/bin/python3.4: Error while finding spec for 'ensurepip.__main__' (class 'ImportError': /build-directory/build/lib.linux-i686-3.4/time.cpython-34m.so: wrong ELF class: ELFCLASS32); 'ensurepip' is a package and cannot be directly executed make: *** [install] Error 1 2. setup.py is missing -lm flag for several modules. On Linux this problem is hidden because libm is already loaded by the executable calling dlopen(), but Android's loader deals with unknown symbols differently (searches only the libs explicitly linked against the module being loaded.) http://bugs.python.org/issue21668 reports the problem for selectmodule (can't find ceil()) and timemodule (fmod() and floor()). But there are at least two more: audioop fails to load because it needs floor() and ctypes_test fails to load because it needs sqrt(). I'll happily update the patch in 21668. Is there any fundamental objection to adding the -lm flag to the link step where it is necessary? 3. What is ossaudiodev? It tries to include sys/soundcard.h, which I don't have on my system. (The rule in setup.py is wrapped in a test for host of Linux/FreeBSD/Darwin, but Android x86 gets configured with --host=i686-linux-android so to turn it off requires an extra test for and not cross_compiling.) Can I just turn off ossaudiodev for cross compiling or might someone want it in a different type of cross build? (In which case I think I'll have to write some kind autoconf rule for it, which I don't quite know how to do yet.) 4. Module _decimal is failing to compile. The problem is that it has a header called memory.h. Android's libc has the problem that /usr/include/stdlib.h includes memory.h. But the build system puts -I. on the include path before the system dirs (as it should) so when compiling _decimal, Modules/_decimal/libmpdec/memory.h gets found instead of /usr/include/memory.h. Shiz has a patch here: https://github.com/rave-engine/python3-android/blob/master/mk/python/3.3.5/p\ ython-3.3.5-android-libmpdec.patch (which renames memory.h - mpmemory.h) but I don't know a. Is there a tracker for this yet? and b. Is Shiz's fix the desired one or should I be looking for another approach? (Maybe modifying the -I flags for the build of just the build of _decimal or something?) 5. I'm not sure what test configure is actually doing for gethostby*() in a cross-compile environment. In any case Android has a bug where gethostbyaddr_r() is declared in the headers, but not actually implemented in libc. So I have to modify my pyconfig.h by hand to define HAVE_GETHOSTBYNAME and undef HAVE_GETHOSTBYNAME_R and HAVE_GETHOSTBYNAME_R_6_ARG. Is there a variable (like ac_cv_little_endian_double) that I can give to `configure` to make
Re: [Python-Dev] Cross-compiling python and PyQt
On Wed, Jun 6, 2012 at 12:35 AM, Terry Reedy tjre...@udel.edu wrote: On 6/5/2012 4:24 PM, Tarek Sheasha wrote: Hello, I have been working for a long time on cross-compiling python for android I have used projects like: http://code.google.com/p/android-python27/ I am stuck in a certain area, when I am cross-compiling python I would like to install SIP and PyQt4 on the cross-compiled python, I have tried all the possible ways I could think of but have had no success. So if you can help me by giving me some guidelines on how to install third-party software for cross-compiled python for android I would be very helpful. This is off-topic for pydev list (which is for development *of* Python rather than development *with*). I suggest python-list (post in text only, please) or other lists for better help. Yes. And try PySide - it's been ported to distutils, so if distutils supports cross-compiling you may have better luck there. -- anatoly t. ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
[Python-Dev] Cross-compiling python and PyQt
Hello, I have been working for a long time on cross-compiling python for android I have used projects like: http://code.google.com/p/android-python27/ I am stuck in a certain area, when I am cross-compiling python I would like to install SIP and PyQt4 on the cross-compiled python, I have tried all the possible ways I could think of but have had no success. So if you can help me by giving me some guidelines on how to install third-party software for cross-compiled python for android I would be very helpful. Thanks a lot ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
Re: [Python-Dev] Cross-compiling python and PyQt
On 6/5/2012 4:24 PM, Tarek Sheasha wrote: Hello, I have been working for a long time on cross-compiling python for android I have used projects like: http://code.google.com/p/android-python27/ I am stuck in a certain area, when I am cross-compiling python I would like to install SIP and PyQt4 on the cross-compiled python, I have tried all the possible ways I could think of but have had no success. So if you can help me by giving me some guidelines on how to install third-party software for cross-compiled python for android I would be very helpful. This is off-topic for pydev list (which is for development *of* Python rather than development *with*). I suggest python-list (post in text only, please) or other lists for better help. -- Terry Jan Reedy ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
[Python-Dev] Cross Compiling Python
Hi All, I have to cross compile Python to run on Arm processor based MontaVista Linux. If anyone has tried this already, please let me know the procedure. Thanks in advance, Regards, Kumar ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
Re: [Python-Dev] Cross Compiling Python
I have to cross compile Python to run on Arm processor based MontaVista Linux. If anyone has tried this already, please let me know the procedure. Dear Kiran, The python-dev mailing list is for the development *of* Python, not for the development *with* Python; use python-list@python.org for the latter. That said, please take a look at the cross-compilation patch that is currently under review in the patches tracker at sf.net/projects/python. Regards, Martin ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
[Python-Dev] cross compiling python for embedded systems
is this the right place to ask: How could I build the python interpreter for an embedded linux target system (arm9 based), cross-compiling on a linux PC host? thanks, Giovanni Angeli. ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
Re: [Python-Dev] cross compiling python for embedded systems
There's a patch on sourceforge for cross compiling. I haven't used it personally. http://sourceforge.net/tracker/index.php?func=detailaid=1006238group_id=5470atid=305470 Jeff pgpzVmD49shTu.pgp Description: PGP signature ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
Re: [Python-Dev] cross compiling python for embedded systems
[EMAIL PROTECTED] wrote: How could I build the python interpreter for an embedded linux target system (arm9 based), cross-compiling on a linux PC host? No. news:comp.lang.python (aka: mailto:python-list@python.org) would be the right list. This would be the right list for the question I made this and that modification to get it cross-compile, can somebody please review them? Regards, Martin ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com