[prev in list] [next in list] [prev in thread] [next in thread]
List: openembedded-core
Subject: [OE-core] [PATCH] meson: Robustify compiler detection logic
From: "Khem Raj" <raj.khem () gmail ! com>
Date: 2022-03-31 22:29:00
Message-ID: 20220331222900.886985-1-raj.khem () gmail ! com
[Download RAW message or body]
Content-Transfer-Encoding: 8bit
meson would fail to detect compiler type in some rare care where
specific substring '-xt' is detected in compiler --version output and
it so happens that this string can be generated by clang --version if
clang is installed into a directory containing 'xt-' in its name. with
recipe specific sysroots, this is quite likely to happen in OE build
system as we are seeing the issue with newly proposed gnome-text-editor
recipe
https://lists.openembedded.org/g/openembedded-devel/topic/90150031#96301
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
...for-clang-before-guessing-gcc-or-lcc.patch | 56 +++++++++++++++++++
meta/recipes-devtools/meson/meson_0.61.3.bb | 1 +
2 files changed, 57 insertions(+)
create mode 100644 meta/recipes-devtools/meson/meson/0001-Check-for-clang-before-guessing-gcc-or-lcc.patch
diff --git a/meta/recipes-devtools/meson/meson/0001-Check-for-clang-before-guessing-gcc-or-lcc.patch \
b/meta/recipes-devtools/meson/meson/0001-Check-for-clang-before-guessing-gcc-or-lcc.patch
new file mode 100644
index 00000000000..58fa1194398
--- /dev/null
+++ b/meta/recipes-devtools/meson/meson/0001-Check-for-clang-before-guessing-gcc-or-lcc.patch
@@ -0,0 +1,56 @@
+From 8739e1c3bef653415ad4b9b9c318ccfa76c43da6 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Thu, 31 Mar 2022 15:00:24 -0700
+Subject: [PATCH] Check for clang before guessing gcc or lcc
+
+clang --version can yield a string like below when its installed into
+such a directory
+
+clang version 14.0.0 (https://github.com/llvm/llvm-project \
3f43d803382d57e3fc010ca19833077d1023e9c9) +Target: aarch64-yoe-linux
+Thread model: posix
+InstalledDir: /mnt/b/yoe/master/build/tmp/work/cortexa72-yoe-linux/gnome-text-editor/42.0-r0/recipe-sysroot-native/usr/bin/aarch64-yoe-linux
+
+as you can see InstallDir has 'xt-' subtring and this trips the check to
+guess gcc
+
+if 'Free Software Foundation' in out or 'xt-' in out:
+
+Therefore, check if compiler is clang then there is no point of running
+this check anyway.
+
+Upstream-Status: Submitted [https://github.com/mesonbuild/meson/pull/10218]
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ mesonbuild/compilers/detect.py | 15 ++++++++-------
+ 1 file changed, 8 insertions(+), 7 deletions(-)
+
+diff --git a/mesonbuild/compilers/detect.py b/mesonbuild/compilers/detect.py
+index 53948b01a..ba335cf39 100644
+--- a/mesonbuild/compilers/detect.py
++++ b/mesonbuild/compilers/detect.py
+@@ -427,13 +427,14 @@ def _detect_c_or_cpp_compiler(env: 'Environment', lang: str, \
for_machine: Machin + version = search_version(out)
+
+ guess_gcc_or_lcc: T.Optional[str] = None
+- if 'Free Software Foundation' in out or 'xt-' in out:
+- guess_gcc_or_lcc = 'gcc'
+- if 'e2k' in out and 'lcc' in out:
+- guess_gcc_or_lcc = 'lcc'
+- if 'Microchip Technology' in out:
+- # this output has "Free Software Foundation" in its version
+- guess_gcc_or_lcc = None
++ if not 'clang' in compiler_name:
++ if 'Free Software Foundation' in out or 'xt-' in out:
++ guess_gcc_or_lcc = 'gcc'
++ if 'e2k' in out and 'lcc' in out:
++ guess_gcc_or_lcc = 'lcc'
++ if 'Microchip Technology' in out:
++ # this output has "Free Software Foundation" in its version
++ guess_gcc_or_lcc = None
+
+ if guess_gcc_or_lcc:
+ defines = _get_gnu_compiler_defines(compiler)
+--
+2.35.1
+
diff --git a/meta/recipes-devtools/meson/meson_0.61.3.bb \
b/meta/recipes-devtools/meson/meson_0.61.3.bb index 92f99a902d9..1c21493f823 100644
--- a/meta/recipes-devtools/meson/meson_0.61.3.bb
+++ b/meta/recipes-devtools/meson/meson_0.61.3.bb
@@ -15,6 +15,7 @@ SRC_URI = \
"https://github.com/mesonbuild/meson/releases/download/${PV}/meson-${P \
file://0001-Make-CPU-family-warnings-fatal.patch \ \
file://0002-Support-building-allarch-recipes-again.patch \ \
file://0001-is_debianlike-always-return-False.patch \ + \
file://0001-Check-for-clang-before-guessing-gcc-or-lcc.patch \ "
SRC_URI[sha256sum] = \
"9c884434469471f3fe0cbbceb9b9ea0c8047f19e792940e1df6595741aae251b"
--
2.35.1
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#163875): https://lists.openembedded.org/g/openembedded-core/message/163875
Mute This Topic: https://lists.openembedded.org/mt/90166169/4454766
Group Owner: openembedded-core+owner@lists.openembedded.org
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [openembedded-core@marc.info]
-=-=-=-=-=-=-=-=-=-=-=-
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic