Patrick Williams | 03907ee | 2022-05-01 06:28:52 -0500 | [diff] [blame^] | 1 | From dc966f1278c1077938626d682666767d2c8d0c72 Mon Sep 17 00:00:00 2001 |
| 2 | From: Khem Raj <raj.khem@gmail.com> |
| 3 | Date: Sat, 9 Apr 2022 18:29:47 +0000 |
| 4 | Subject: [PATCH] setup.py: Do not detect multiarch paths when cross-compiling |
| 5 | |
| 6 | add_multiarch_paths() function relies on host tools like dpkg-configure |
| 7 | to operate, which is not good when cross compiling, since it ends up |
| 8 | adding native paths in includes in certain cases, e.g. when building |
| 9 | for aarch64 targets using aarch64 build hosts running debian-like |
| 10 | distributions e.g. ubuntu, it ends up adding native multiarch paths |
| 11 | -I/usr/include/aarch64-linux-gnu during cross compile and since arches |
| 12 | are so similar, cross compiler (epecially clang) is inhererently configured |
| 13 | with multiarch ends up adding these paths to compiler cmdline which |
| 14 | works ok with gcc since headers are similar but clang barfs on some gcc |
| 15 | extentions and build fails due to missing gnu extentions but it silently |
| 16 | compiles when using cross gcc. |
| 17 | |
| 18 | Fixes python3 cross build by not running this funciton when cross compiling |
| 19 | |
| 20 | Upstream-Status: Inappropriate [OE-Specific] |
| 21 | Signed-off-by: Khem Raj <raj.khem@gmail.com> |
| 22 | --- |
| 23 | setup.py | 3 ++- |
| 24 | 1 file changed, 2 insertions(+), 1 deletion(-) |
| 25 | |
| 26 | diff --git a/setup.py b/setup.py |
| 27 | index 2e7f263..f7a3d39 100644 |
| 28 | --- a/setup.py |
| 29 | +++ b/setup.py |
| 30 | @@ -840,7 +840,8 @@ class PyBuildExt(build_ext): |
| 31 | # only change this for cross builds for 3.3, issues on Mageia |
| 32 | if CROSS_COMPILING: |
| 33 | self.add_cross_compiling_paths() |
| 34 | - self.add_multiarch_paths() |
| 35 | + if not CROSS_COMPILING: |
| 36 | + self.add_multiarch_paths() |
| 37 | self.add_ldflags_cppflags() |
| 38 | |
| 39 | def init_inc_lib_dirs(self): |
| 40 | -- |
| 41 | 2.25.1 |
| 42 | |