From patchwork Thu Mar 31 22:29:00 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Khem Raj X-Patchwork-Id: 6155 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id B0555C433F5 for ; Thu, 31 Mar 2022 22:29:05 +0000 (UTC) Received: from mail-pf1-f172.google.com (mail-pf1-f172.google.com [209.85.210.172]) by mx.groups.io with SMTP id smtpd.web12.3617.1648765744380352760 for ; Thu, 31 Mar 2022 15:29:04 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@gmail.com header.s=20210112 header.b=G9JgfFHN; spf=pass (domain: gmail.com, ip: 209.85.210.172, mailfrom: raj.khem@gmail.com) Received: by mail-pf1-f172.google.com with SMTP id x31so892653pfh.9 for ; Thu, 31 Mar 2022 15:29:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=5uJHKteJ3OBUssAXoaW2OxBMOmaHjrGE69oP71TuMic=; b=G9JgfFHNkeG/Aov9HzO2CvyeJdAPgfntDDeu0WpKMiAKKKBFDnk1bi7Y8XbhDYTkbm p9jOBoQqNFBny22kkhPxTTT0Za9o+xK3DRVxcB+EdlFqzY65JsI9EvLh4XFaqaa2jnSI 6UWxEJslzwSeapE1zaCqddsSvjZLvWMoIZVCOxDVSFMjlZ5Xz3yQQTIeP2A+Rq1nap7V 3s9MjuaFLa4bGVUAtqDlB7Gg4ZP1qxIxNJaGKXQk8du6K4PWzs1+7X5lotUqUc44n6/G iV+b7yMWJPMUlcquZBo09y0Ue7Cu7DcLR+D2867xWF4dENi5ydLFoq/JT83jcXcU4u1R 1V5g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=5uJHKteJ3OBUssAXoaW2OxBMOmaHjrGE69oP71TuMic=; b=oL+fQ3O9zzzw72UpmgwtEvCrbzbbmnL9nj+lB8FAE1TUJXd5sw9kpbQjeqH18+EEk+ KRM4a+WJB2STPndIBocpVa6eIitVVhQm7p+VEXW+qur3s6JvvjAl5QelEHPMDgdo45d+ 4xnrPJOpwJIbWzmDIy9djh1B/oV9toS6kubWw44VrWdWjcuN/GypVf08HEj5DCJPu4Db /QxhvF6s5qcnaxiqWoI0+hKRZsIeChg8fw5Cu00g7OqiyMtiP4PuqESnyglJS+wkwusi p5x+pL49BipjYKg/ETnNJkju0URmHmmtjLSI/gFW4asXuhjmcg2WT71RTkWEqJt6O5uz 9bLA== X-Gm-Message-State: AOAM531lVfDcLnOVspC/BZV65wm1tgeoV4aS+EjDXxitseG//U/kZGEV Kp/5rGwUo2A1P4ZC6UrxxkX+laz6S2g= X-Google-Smtp-Source: ABdhPJwb7cO7/zPw137zkUO5oBWo1w1vd3nLGfeCJtM6sSNETnIwjBW1NQX+ugPoDpKvJ89savjYzA== X-Received: by 2002:a05:6a00:18a4:b0:4fa:ee98:87bb with SMTP id x36-20020a056a0018a400b004faee9887bbmr7716663pfh.2.1648765743555; Thu, 31 Mar 2022 15:29:03 -0700 (PDT) Received: from apollo.hsd1.ca.comcast.net ([2601:646:9200:a0f0::781b]) by smtp.gmail.com with ESMTPSA id q18-20020aa78432000000b004fb0a5aa2c7sm488174pfn.183.2022.03.31.15.29.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 31 Mar 2022 15:29:03 -0700 (PDT) From: Khem Raj To: openembedded-core@lists.openembedded.org Cc: Khem Raj Subject: [PATCH] meson: Robustify compiler detection logic Date: Thu, 31 Mar 2022 15:29:00 -0700 Message-Id: <20220331222900.886985-1-raj.khem@gmail.com> X-Mailer: git-send-email 2.35.1 MIME-Version: 1.0 List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Thu, 31 Mar 2022 22:29:05 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/163875 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 --- ...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 +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 +--- + 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"