Author xdegaye
Recipients Benedikt.Morbach, doko, ncoghlan, rpetrov, xdegaye
Date 2016-06-27.08:22:55
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1467015777.79.0.240906876829.issue22724@psf.upfronthosting.co.za>
In-reply-to
Content
The byte-compiling for cross-builds fails because PYTHON_FOR_BUILD defined in configure, sets PYTHONPATH with the directory of the newly built extension modules shared libraries and because PYTHON_FOR_BUILD is used to run compileall.py in the Makefile. PYTHON_FOR_BUILD, i.e. the native python running on the build system, attempts to load the newly compiled libraries for the foreign host system and fails.

The problem is more difficult to reproduce after changeset 11c4f3f936e7 in issue 22980 since the shared libraries names include now a PLATFORM_TRIPLET that prevents the wrong library to be loaded in most cases. On Android cross-builds, it should be possible to reproduce the failure when the build system and the host system have the same PLATFORM_TRIPLET. In all cases, the interpreter used to run compileall.py imports the wrong _sysconfigdata module.

To fix this problem, this patch adds the -E option to PYTHON_FOR_BUILD when running compileall in the Makefile and 'cross_compiling' is set. The patch does not fix the fact that, when 'cross_compiling' is not set, PYTHONPATH is set to '$(DESTDIR)$(LIBDEST)' in the Makefile at the beginning of the statement that runs compileall.py while PYTHON_FOR_BUILD is set to './$(BUILDPYTHON) -E', something is obviously wrong here. So the patch would be simpler if '-E' was used in both cases, but I don't know what would be lost by removing this setting of PYTHONPATH at the beginning of those compileall statements, IOW what was their initial purpose.
History
Date User Action Args
2016-06-27 08:22:58xdegayesetrecipients: + xdegaye, doko, ncoghlan, rpetrov, Benedikt.Morbach
2016-06-27 08:22:57xdegayesetmessageid: <1467015777.79.0.240906876829.issue22724@psf.upfronthosting.co.za>
2016-06-27 08:22:57xdegayelinkissue22724 messages
2016-06-27 08:22:57xdegayecreate