diff options
author | Yoann Congal <yoann.congal@smile.fr> | 2025-03-20 14:40:08 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2025-03-20 17:49:16 +0000 |
commit | 503ff92f45060fd9e0a2db0d75019a1aaefdcec2 (patch) | |
tree | 88b5379818376db5c99176d1b9aa619cb7b063fe | |
parent | 07563ec1b567a4ce4227fa0623a84ba93c1c0c13 (diff) | |
download | poky-503ff92f45060fd9e0a2db0d75019a1aaefdcec2.tar.gz |
sanity: Refactor "C++ toolchain support this flag" check
This can be use to check for other flags.
(From OE-Core rev: 42d012e8414736d89618422fb6f9bce9e4a2a391)
Signed-off-by: Yoann Congal <yoann.congal@smile.fr>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r-- | meta/classes-global/sanity.bbclass | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/meta/classes-global/sanity.bbclass b/meta/classes-global/sanity.bbclass index 7f83239c6e..d415611e3d 100644 --- a/meta/classes-global/sanity.bbclass +++ b/meta/classes-global/sanity.bbclass | |||
@@ -607,9 +607,9 @@ def drop_v14_cross_builds(d): | |||
607 | bb.utils.remove(stamp + "*") | 607 | bb.utils.remove(stamp + "*") |
608 | bb.utils.remove(workdir, recurse = True) | 608 | bb.utils.remove(workdir, recurse = True) |
609 | 609 | ||
610 | def check_cpp_toolchain(d): | 610 | def check_cpp_toolchain_flag(d, flag, error_message=None): |
611 | """ | 611 | """ |
612 | it checks if the c++ compiling and linking to libstdc++ works properly in the native system | 612 | Checks if the C++ toolchain support the given flag |
613 | """ | 613 | """ |
614 | import shlex | 614 | import shlex |
615 | import subprocess | 615 | import subprocess |
@@ -622,12 +622,12 @@ def check_cpp_toolchain(d): | |||
622 | } | 622 | } |
623 | """ | 623 | """ |
624 | 624 | ||
625 | cmd = shlex.split(d.getVar("BUILD_CXX")) + ["-x", "c++","-", "-o", "/dev/null", "-lstdc++"] | 625 | cmd = shlex.split(d.getVar("BUILD_CXX")) + ["-x", "c++","-", "-o", "/dev/null", flag] |
626 | try: | 626 | try: |
627 | subprocess.run(cmd, input=cpp_code, capture_output=True, text=True, check=True) | 627 | subprocess.run(cmd, input=cpp_code, capture_output=True, text=True, check=True) |
628 | return None | 628 | return None |
629 | except subprocess.CalledProcessError as e: | 629 | except subprocess.CalledProcessError as e: |
630 | return f"An unexpected issue occurred during the C++ toolchain check: {str(e)}" | 630 | return error_message or f"An unexpected issue occurred during the C++ toolchain check: {str(e)}" |
631 | 631 | ||
632 | def sanity_handle_abichanges(status, d): | 632 | def sanity_handle_abichanges(status, d): |
633 | # | 633 | # |
@@ -802,7 +802,7 @@ def check_sanity_version_change(status, d): | |||
802 | status.addresult(check_case_sensitive(tmpdir, "TMPDIR")) | 802 | status.addresult(check_case_sensitive(tmpdir, "TMPDIR")) |
803 | 803 | ||
804 | # Check if linking with lstdc++ is failing | 804 | # Check if linking with lstdc++ is failing |
805 | status.addresult(check_cpp_toolchain(d)) | 805 | status.addresult(check_cpp_toolchain_flag(d, "-lstdc++")) |
806 | 806 | ||
807 | def sanity_check_locale(d): | 807 | def sanity_check_locale(d): |
808 | """ | 808 | """ |