mirror of
https://git.yoctoproject.org/poky
synced 2026-01-29 21:08:42 +01:00
meson: Robustify compiler detection logic
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 (From OE-Core rev: ff75909f2a9e970aaf389e0012888c29f02376e3) Signed-off-by: Khem Raj <raj.khem@gmail.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user