From: Bastian Stender Date: Mon, 8 Jan 2018 16:11:23 +0100 Subject: [PATCH] python3: prevent host path leakage If cross-compiling and host/target architecture match host paths are added to include_dirs and library_dirs in add_multiarch_paths() (e.g. /usr/lib/i386-linux-gnu, /usr/include/i386-linux-gnu). This leads to build failures for some extensions (at least _ssl and _socket). ptxdist does not support multiarch, so remove this addition when cross-compiling. Based on a patch by Alexandru Ardelean . See these patches for reference: - https://github.com/openwrt/packages/pull/784 - https://github.com/openwrt/packages/blob/master/lang/python/python/patches/006-remove-multi-arch-and-local-paths.patch - http://cgit.openembedded.org/openembedded-core/tree/meta/recipes-devtools/python/python/host_include_contamination.patch Signed-off-by: Bastian Stender --- setup.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/setup.py b/setup.py index b8a35218b259..be779cafc95f 100644 --- a/setup.py +++ b/setup.py @@ -587,10 +587,12 @@ class PyBuildExt(build_ext): if not cross_compiling: add_dir_to_list(self.compiler.library_dirs, '/usr/local/lib') add_dir_to_list(self.compiler.include_dirs, '/usr/local/include') + + self.add_multiarch_paths() + # only change this for cross builds for 3.3, issues on Mageia if cross_compiling: self.add_gcc_paths() - self.add_multiarch_paths() # Add paths specified in the environment variables LDFLAGS and # CPPFLAGS for header and library files.