diff -Naur Python-2.7.9-orig/configure.ac Python-2.7.9/configure.ac --- Python-2.7.9-orig/configure.ac 2014-12-11 13:51:03.523400000 +0300 +++ Python-2.7.9/configure.ac 2014-12-11 13:51:06.783800000 +0300 @@ -33,7 +33,12 @@ AC_MSG_ERROR([python$PACKAGE_VERSION interpreter not found]) fi AC_MSG_RESULT($interp) - PYTHON_FOR_BUILD='_PYTHON_PROJECT_BASE=$(abs_builddir) _PYTHON_HOST_PLATFORM=$(_PYTHON_HOST_PLATFORM) PYTHONPATH=$(shell test -f pybuilddir.txt && echo $(abs_builddir)/`cat pybuilddir.txt`:)$(srcdir)/Lib:$(srcdir)/Lib/$(PLATDIR) '$interp + # For reference see: http://bugs.python.org/msg180577 + # interp's DESTSHARED must appear before that contained in pybuilddir.txt as otherwise, when compiling during make install, + # the build Python will attempt to load shared modules from the host Python, which will fail due to them being of the wrong + # architecture (e.g. x86_64 vs x86 or arm). It would probably be better if _sysconfigdata.py was placed elsewhere, + # i.e. in a folder that does not also contain incompatible shared modules. + PYTHON_FOR_BUILD='_PYTHON_PROJECT_BASE=$(abs_builddir) _PYTHON_HOST_PLATFORM=$(_PYTHON_HOST_PLATFORM) PYTHONPATH='$($interp -c "import sysconfig; print sysconfig.get_config_var(\"DESTSHARED\")")':$(shell test -f pybuilddir.txt && echo $(abs_builddir)/`cat pybuilddir.txt`:)$(srcdir)/Lib:$(srcdir)/Lib/$(PLATDIR) '$interp fi elif test "$cross_compiling" = maybe; then AC_MSG_ERROR([Cross compiling required --host=HOST-TUPLE and --build=ARCH])