diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2025-07-01 22:28:21 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2025-07-03 10:40:16 +0100 |
commit | 862447427783352dbab916d901ad38d4792f5328 (patch) | |
tree | 145edaba149b03b156f9c81a93ba5862b2fb4d25 | |
parent | 204653a519b341353dc129b1471291bb202460e5 (diff) | |
download | poky-862447427783352dbab916d901ad38d4792f5328.tar.gz |
sanity/utils: Directly use gcc, not BUILD_CC
The test/helper is written assuming gcc, so just call that and stop
accessing BUILD_CC which may be set to clang.
(From OE-Core rev: 0a165a93693a293f08cb0d7e2dfa1016803a917a)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r-- | meta/classes-global/sanity.bbclass | 9 | ||||
-rw-r--r-- | 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 d1452967fc..3c103d3bfb 100644 --- a/meta/classes-global/sanity.bbclass +++ b/meta/classes-global/sanity.bbclass | |||
@@ -514,12 +514,9 @@ def check_userns(): | |||
514 | # built buildtools-extended-tarball) | 514 | # built buildtools-extended-tarball) |
515 | # | 515 | # |
516 | def check_gcc_version(sanity_data): | 516 | def check_gcc_version(sanity_data): |
517 | import subprocess | 517 | version = oe.utils.get_host_gcc_version(sanity_data) |
518 | 518 | if bb.utils.vercmp_string_op(version, "8.0", "<"): | |
519 | build_cc, version = oe.utils.get_host_compiler_version(sanity_data) | 519 | 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" |
520 | if build_cc.strip() == "gcc": | ||
521 | if bb.utils.vercmp_string_op(version, "8.0", "<"): | ||
522 | 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" | ||
523 | return None | 520 | return None |
524 | 521 | ||
525 | # Tar version 1.24 and onwards handle overwriting symlinks correctly | 522 | # 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 0378071b5c..779c5e593f 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): | |||
415 | return output_str | 415 | return output_str |
416 | 416 | ||
417 | 417 | ||
418 | # Helper function to get the host compiler version | 418 | # Helper function to get the host gcc version |
419 | # Do not assume the compiler is gcc | 419 | def get_host_gcc_version(d, taskcontextonly=False): |
420 | def get_host_compiler_version(d, taskcontextonly=False): | ||
421 | import re, subprocess | 420 | import re, subprocess |
422 | 421 | ||
423 | if taskcontextonly and d.getVar('BB_WORKERCONTEXT') != '1': | 422 | if taskcontextonly and d.getVar('BB_WORKERCONTEXT') != '1': |
424 | return | 423 | return |
425 | 424 | ||
426 | compiler = d.getVar("BUILD_CC") | ||
427 | # Get rid of ccache since it is not present when parsing. | ||
428 | if compiler.startswith('ccache '): | ||
429 | compiler = compiler[7:] | ||
430 | try: | 425 | try: |
431 | env = os.environ.copy() | 426 | env = os.environ.copy() |
432 | # datastore PATH does not contain session PATH as set by environment-setup-... | 427 | # datastore PATH does not contain session PATH as set by environment-setup-... |
433 | # this breaks the install-buildtools use-case | 428 | # this breaks the install-buildtools use-case |
434 | # env["PATH"] = d.getVar("PATH") | 429 | # env["PATH"] = d.getVar("PATH") |
435 | output = subprocess.check_output("%s --version" % compiler, \ | 430 | output = subprocess.check_output("gcc --version", \ |
436 | shell=True, env=env, stderr=subprocess.STDOUT).decode("utf-8") | 431 | shell=True, env=env, stderr=subprocess.STDOUT).decode("utf-8") |
437 | except subprocess.CalledProcessError as e: | 432 | except subprocess.CalledProcessError as e: |
438 | bb.fatal("Error running %s --version: %s" % (compiler, e.output.decode("utf-8"))) | 433 | bb.fatal("Error running gcc --version: %s" % (e.output.decode("utf-8"))) |
439 | 434 | ||
440 | match = re.match(r".* (\d+\.\d+)\.\d+.*", output.split('\n')[0]) | 435 | match = re.match(r".* (\d+\.\d+)\.\d+.*", output.split('\n')[0]) |
441 | if not match: | 436 | if not match: |
442 | bb.fatal("Can't get compiler version from %s --version output" % compiler) | 437 | bb.fatal("Can't get compiler version from gcc --version output") |
443 | 438 | ||
444 | version = match.group(1) | 439 | version = match.group(1) |
445 | return compiler, version | 440 | return version |
446 | 441 | ||
447 | @bb.parse.vardepsexclude("DEFAULTTUNE_MULTILIB_ORIGINAL", "OVERRIDES") | 442 | @bb.parse.vardepsexclude("DEFAULTTUNE_MULTILIB_ORIGINAL", "OVERRIDES") |
448 | def get_multilib_datastore(variant, d): | 443 | def get_multilib_datastore(variant, d): |