From: Khem Raj <raj.khem@gmail.com>
To: openembedded-core@lists.openembedded.org
Cc: Richard Purdie <richard.purdie@linuxfoundation.org>,
Khem Raj <raj.khem@gmail.com>
Subject: [PATCH v5 4/5] sanity/utils: Directly use gcc, not BUILD_CC
Date: Tue, 1 Jul 2025 22:32:19 -0700 [thread overview]
Message-ID: <20250702053220.4104358-4-raj.khem@gmail.com> (raw)
In-Reply-To: <20250702053220.4104358-1-raj.khem@gmail.com>
From: Richard Purdie <richard.purdie@linuxfoundation.org>
The test/helper is written assuming gcc, so just call that and stop
accessing BUILD_CC which may be set to clang.
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
meta/classes-global/sanity.bbclass | 9 +++------
meta/lib/oe/utils.py | 17 ++++++-----------
2 files changed, 9 insertions(+), 17 deletions(-)
diff --git a/meta/classes-global/sanity.bbclass b/meta/classes-global/sanity.bbclass
index d1452967fc1..3c103d3bfb3 100644
--- a/meta/classes-global/sanity.bbclass
+++ b/meta/classes-global/sanity.bbclass
@@ -514,12 +514,9 @@ def check_userns():
# built buildtools-extended-tarball)
#
def check_gcc_version(sanity_data):
- import subprocess
-
- build_cc, version = oe.utils.get_host_compiler_version(sanity_data)
- if build_cc.strip() == "gcc":
- if bb.utils.vercmp_string_op(version, "8.0", "<"):
- return "Your version of gcc is older than 8.0 and will break builds. Please install a newer version of gcc (you could use the project's buildtools-extended-tarball or use scripts/install-buildtools).\n"
+ version = oe.utils.get_host_gcc_version(sanity_data)
+ if bb.utils.vercmp_string_op(version, "8.0", "<"):
+ return "Your version of gcc is older than 8.0 and will break builds. Please install a newer version of gcc (you could use the project's buildtools-extended-tarball or use scripts/install-buildtools).\n"
return None
# Tar version 1.24 and onwards handle overwriting symlinks correctly
diff --git a/meta/lib/oe/utils.py b/meta/lib/oe/utils.py
index a11db5f3cd9..27d304ec72d 100644
--- a/meta/lib/oe/utils.py
+++ b/meta/lib/oe/utils.py
@@ -415,34 +415,29 @@ def format_pkg_list(pkg_dict, ret_format=None, pkgdata_dir=None):
return output_str
-# Helper function to get the host compiler version
-# Do not assume the compiler is gcc
-def get_host_compiler_version(d, taskcontextonly=False):
+# Helper function to get the host gcc version
+def get_host_gcc_version(d, taskcontextonly=False):
import re, subprocess
if taskcontextonly and d.getVar('BB_WORKERCONTEXT') != '1':
return
- compiler = d.getVar("BUILD_CC")
- # Get rid of ccache since it is not present when parsing.
- if compiler.startswith('ccache '):
- compiler = compiler[7:]
try:
env = os.environ.copy()
# datastore PATH does not contain session PATH as set by environment-setup-...
# this breaks the install-buildtools use-case
# env["PATH"] = d.getVar("PATH")
- output = subprocess.check_output("%s --version" % compiler, \
+ output = subprocess.check_output("gcc --version", \
shell=True, env=env, stderr=subprocess.STDOUT).decode("utf-8")
except subprocess.CalledProcessError as e:
- bb.fatal("Error running %s --version: %s" % (compiler, e.output.decode("utf-8")))
+ bb.fatal("Error running gcc --version: %s" % (e.output.decode("utf-8")))
match = re.match(r".* (\d+\.\d+)\.\d+.*", output.split('\n')[0])
if not match:
- bb.fatal("Can't get compiler version from %s --version output" % compiler)
+ bb.fatal("Can't get compiler version from gcc --version output")
version = match.group(1)
- return compiler, version
+ return version
def host_gcc_version(d, taskcontextonly=False):
next prev parent reply other threads:[~2025-07-02 5:32 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-02 5:32 [PATCH v5 1/5] clang-native: Add class to use clang as native compiler Khem Raj
2025-07-02 5:32 ` [PATCH v5 2/5] base.bbclass: Deferred inherit native toolchain class Khem Raj
2025-07-02 5:32 ` [PATCH v5 3/5] compiler-rt,libcxx: Use clang for native versions as well Khem Raj
2025-07-02 5:32 ` Khem Raj [this message]
2025-07-02 5:48 ` Patchtest results for [PATCH v5 4/5] sanity/utils: Directly use gcc, not BUILD_CC patchtest
2025-07-02 5:32 ` [PATCH v5 5/5] sanity/utils: Directly use gcc instead of BUILD_CC in host_gcc_version Khem Raj
2025-07-02 10:33 ` [OE-core] " Antonin Godard
2025-07-02 10:37 ` Richard Purdie
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=20250702053220.4104358-4-raj.khem@gmail.com \
--to=raj.khem@gmail.com \
--cc=openembedded-core@lists.openembedded.org \
--cc=richard.purdie@linuxfoundation.org \
/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.