New submission from Xavier de Gaye: With this patch, cross compiling a third-party extension module is done with the command:
XBUILD_PYTHON_DIR=/path/to/python/dir python setup.py build where XBUILD_PYTHON_DIR is the location of the directory of the cross-compiled python executable. It may be: a) The build tree, which is the source tree when the cross compilation is not out of the source tree. b) '$DESTDIR/$exec_prefix/bin' when the cross built python has been installed with 'make DESTDIR=/some/path install'. In that case 'prefix' and 'exec_prefix' may be different. c) When the result of the cross compilation has been manually copied (for example to /some/path) and if 'prefix' and 'exec_prefix' are identical, this is /some/path/bin. In case b), one can use the 'install' setup.py command instead of the 'build' command, to build and install the extension module to '$DESTDIR/$exec_prefix/lib/python$VERSION/site-packages' with the appropriate 'egg-info' file. The patch uses the 'python-config' shell script (created at issue 16235 [1]) that is initialized with the proper variables at the configure stage to provide the minimum information required by the sysconfig module to create (with the option --generate-posix-vars) the sysconfigdata file or to import the sysconfigdata module. The patch also fixes issue 22724 [2] as sys.path is only modified during the time needed to import the sysconfigdata module. The patch fixes two minor problems: * '_PYTHON_HOST_PLATFORM' in Makefile.pre.in was not added to the sysconfig variables as intended, since those variables may not be prefixed with an underscore. * The sysconfigdata file name was terminated with a dangling underscore when 'multiarch' is not defined. Patch also tested with pyephem on an Android emulator. The patch misses the documentation. Please run autoconf after installing the patch. [1] issue 16235: add python-config.sh for use during cross compilation http://bugs.python.org/issue16235 [2] issue 22724: byte-compile fails for cross-builds http://bugs.python.org/issue22724 ---------- assignee: xdegaye components: Cross-Build files: cross-build-extension.patch keywords: patch messages: 281993 nosy: Alex.Willmer, doko, dstufft, eric.araujo, haypo, martin.panter, xdegaye, zach.ware priority: normal severity: normal stage: patch review status: open title: cross compilation of third-party extension modules type: behavior versions: Python 3.6, Python 3.7 Added file: http://bugs.python.org/file45688/cross-build-extension.patch _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue28833> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com