diff options
| author | Khem Raj <raj.khem@gmail.com> | 2022-03-31 15:29:00 -0700 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2022-04-01 23:11:38 +0100 |
| commit | 3fdbeb0895a5dcc70fdfa22154cbead9b707323f (patch) | |
| tree | 58245dbe7c3cba184063f2fed73db081ab0ba1a9 | |
| parent | 2802ea07a836362fa0a26303363d41edab20ed52 (diff) | |
| download | poky-3fdbeb0895a5dcc70fdfa22154cbead9b707323f.tar.gz | |
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>
| -rw-r--r-- | meta/recipes-devtools/meson/meson/0001-Check-for-clang-before-guessing-gcc-or-lcc.patch | 56 | ||||
| -rw-r--r-- | meta/recipes-devtools/meson/meson_0.61.3.bb | 1 |
2 files changed, 57 insertions, 0 deletions
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 0000000000..58fa119439 --- /dev/null +++ b/meta/recipes-devtools/meson/meson/0001-Check-for-clang-before-guessing-gcc-or-lcc.patch | |||
| @@ -0,0 +1,56 @@ | |||
| 1 | From 8739e1c3bef653415ad4b9b9c318ccfa76c43da6 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Khem Raj <raj.khem@gmail.com> | ||
| 3 | Date: Thu, 31 Mar 2022 15:00:24 -0700 | ||
| 4 | Subject: [PATCH] Check for clang before guessing gcc or lcc | ||
| 5 | |||
| 6 | clang --version can yield a string like below when its installed into | ||
| 7 | such a directory | ||
| 8 | |||
| 9 | clang version 14.0.0 (https://github.com/llvm/llvm-project 3f43d803382d57e3fc010ca19833077d1023e9c9) | ||
| 10 | Target: aarch64-yoe-linux | ||
| 11 | Thread model: posix | ||
| 12 | 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 | ||
| 13 | |||
| 14 | as you can see InstallDir has 'xt-' subtring and this trips the check to | ||
| 15 | guess gcc | ||
| 16 | |||
| 17 | if 'Free Software Foundation' in out or 'xt-' in out: | ||
| 18 | |||
| 19 | Therefore, check if compiler is clang then there is no point of running | ||
| 20 | this check anyway. | ||
| 21 | |||
| 22 | Upstream-Status: Submitted [https://github.com/mesonbuild/meson/pull/10218] | ||
| 23 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
| 24 | --- | ||
| 25 | mesonbuild/compilers/detect.py | 15 ++++++++------- | ||
| 26 | 1 file changed, 8 insertions(+), 7 deletions(-) | ||
| 27 | |||
| 28 | diff --git a/mesonbuild/compilers/detect.py b/mesonbuild/compilers/detect.py | ||
| 29 | index 53948b01a..ba335cf39 100644 | ||
| 30 | --- a/mesonbuild/compilers/detect.py | ||
| 31 | +++ b/mesonbuild/compilers/detect.py | ||
| 32 | @@ -427,13 +427,14 @@ def _detect_c_or_cpp_compiler(env: 'Environment', lang: str, for_machine: Machin | ||
| 33 | version = search_version(out) | ||
| 34 | |||
| 35 | guess_gcc_or_lcc: T.Optional[str] = None | ||
| 36 | - if 'Free Software Foundation' in out or 'xt-' in out: | ||
| 37 | - guess_gcc_or_lcc = 'gcc' | ||
| 38 | - if 'e2k' in out and 'lcc' in out: | ||
| 39 | - guess_gcc_or_lcc = 'lcc' | ||
| 40 | - if 'Microchip Technology' in out: | ||
| 41 | - # this output has "Free Software Foundation" in its version | ||
| 42 | - guess_gcc_or_lcc = None | ||
| 43 | + if not 'clang' in compiler_name: | ||
| 44 | + if 'Free Software Foundation' in out or 'xt-' in out: | ||
| 45 | + guess_gcc_or_lcc = 'gcc' | ||
| 46 | + if 'e2k' in out and 'lcc' in out: | ||
| 47 | + guess_gcc_or_lcc = 'lcc' | ||
| 48 | + if 'Microchip Technology' in out: | ||
| 49 | + # this output has "Free Software Foundation" in its version | ||
| 50 | + guess_gcc_or_lcc = None | ||
| 51 | |||
| 52 | if guess_gcc_or_lcc: | ||
| 53 | defines = _get_gnu_compiler_defines(compiler) | ||
| 54 | -- | ||
| 55 | 2.35.1 | ||
| 56 | |||
diff --git a/meta/recipes-devtools/meson/meson_0.61.3.bb b/meta/recipes-devtools/meson/meson_0.61.3.bb index 92f99a902d..1c21493f82 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 | |||
| 15 | file://0001-Make-CPU-family-warnings-fatal.patch \ | 15 | file://0001-Make-CPU-family-warnings-fatal.patch \ |
| 16 | file://0002-Support-building-allarch-recipes-again.patch \ | 16 | file://0002-Support-building-allarch-recipes-again.patch \ |
| 17 | file://0001-is_debianlike-always-return-False.patch \ | 17 | file://0001-is_debianlike-always-return-False.patch \ |
| 18 | file://0001-Check-for-clang-before-guessing-gcc-or-lcc.patch \ | ||
| 18 | " | 19 | " |
| 19 | SRC_URI[sha256sum] = "9c884434469471f3fe0cbbceb9b9ea0c8047f19e792940e1df6595741aae251b" | 20 | SRC_URI[sha256sum] = "9c884434469471f3fe0cbbceb9b9ea0c8047f19e792940e1df6595741aae251b" |
| 20 | 21 | ||
