All of lore.kernel.org
 help / color / mirror / Atom feed
From: Khem Raj <raj.khem@gmail.com>
To: openembedded-core@lists.openembedded.org
Cc: Khem Raj <raj.khem@gmail.com>, Ross Burton <ross.burton@arm.com>,
	Jon Mason <jdmason@kudzu.us>
Subject: [master][kirkstone][PATCH] python3: Do not detect multiarch when cross compiling
Date: Sat,  9 Apr 2022 12:27:17 -0700	[thread overview]
Message-ID: <20220409192717.1620524-1-raj.khem@gmail.com> (raw)

This was a long standing problem seen on aarch64 build hosts when
compiling python3 with clang cross compiler. The issue is not seen with
gcc because native glibc headers are still compatible with gcc cross compiler

Signed-off-by: Khem Raj <raj.khem@gmail.com>
Cc: Ross Burton <ross.burton@arm.com>
Cc: Jon Mason <jdmason@kudzu.us>
---
 ...detect-multiarch-paths-when-cross-co.patch | 42 +++++++++++++++++++
 .../recipes-devtools/python/python3_3.10.4.bb |  1 +
 2 files changed, 43 insertions(+)
 create mode 100644 meta/recipes-devtools/python/python3/0001-setup.py-Do-not-detect-multiarch-paths-when-cross-co.patch

diff --git a/meta/recipes-devtools/python/python3/0001-setup.py-Do-not-detect-multiarch-paths-when-cross-co.patch b/meta/recipes-devtools/python/python3/0001-setup.py-Do-not-detect-multiarch-paths-when-cross-co.patch
new file mode 100644
index 00000000000..1844e0efa30
--- /dev/null
+++ b/meta/recipes-devtools/python/python3/0001-setup.py-Do-not-detect-multiarch-paths-when-cross-co.patch
@@ -0,0 +1,42 @@
+From dc966f1278c1077938626d682666767d2c8d0c72 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Sat, 9 Apr 2022 18:29:47 +0000
+Subject: [PATCH] setup.py: Do not detect multiarch paths when cross-compiling
+
+add_multiarch_paths() function relies on host tools like dpkg-configure
+to operate, which is not good when cross compiling, since it ends up
+adding native paths in includes in certain cases, e.g. when building
+for aarch64 targets using aarch64 build hosts running debian-like
+distributions e.g. ubuntu, it ends up adding native multiarch paths
+-I/usr/include/aarch64-linux-gnu during cross compile and since arches
+are so similar, cross compiler (epecially clang) is inhererently configured
+with multiarch ends up adding these paths to compiler cmdline which
+works ok with gcc since headers are similar but clang barfs on some gcc
+extentions and build fails due to missing gnu extentions but it silently
+compiles when using cross gcc.
+
+Fixes python3 cross build by not running this funciton when cross compiling
+
+Upstream-Status: Inappropriate [OE-Specific]
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ setup.py | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/setup.py b/setup.py
+index 2e7f263..f7a3d39 100644
+--- a/setup.py
++++ b/setup.py
+@@ -840,7 +840,8 @@ class PyBuildExt(build_ext):
+         # only change this for cross builds for 3.3, issues on Mageia
+         if CROSS_COMPILING:
+             self.add_cross_compiling_paths()
+-        self.add_multiarch_paths()
++        if not CROSS_COMPILING:
++            self.add_multiarch_paths()
+         self.add_ldflags_cppflags()
+ 
+     def init_inc_lib_dirs(self):
+-- 
+2.25.1
+
diff --git a/meta/recipes-devtools/python/python3_3.10.4.bb b/meta/recipes-devtools/python/python3_3.10.4.bb
index 522f0d71ee5..7eaafe34ad5 100644
--- a/meta/recipes-devtools/python/python3_3.10.4.bb
+++ b/meta/recipes-devtools/python/python3_3.10.4.bb
@@ -32,6 +32,7 @@ SRC_URI = "http://www.python.org/ftp/python/${PV}/Python-${PV}.tar.xz \
            file://makerace.patch \
            file://0001-sysconfig.py-use-platlibdir-also-for-purelib.patch \
            file://0001-Lib-pty.py-handle-stdin-I-O-errors-same-way-as-maste.patch \
+           file://0001-setup.py-Do-not-detect-multiarch-paths-when-cross-co.patch \
            "
 
 SRC_URI:append:class-native = " \
-- 
2.35.1



                 reply	other threads:[~2022-04-11 17:18 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220409192717.1620524-1-raj.khem@gmail.com \
    --to=raj.khem@gmail.com \
    --cc=jdmason@kudzu.us \
    --cc=openembedded-core@lists.openembedded.org \
    --cc=ross.burton@arm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.