diff options
-rw-r--r-- | meta/classes-global/sanity.bbclass | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/meta/classes-global/sanity.bbclass b/meta/classes-global/sanity.bbclass index 7b8a497d5a..66693fc9b9 100644 --- a/meta/classes-global/sanity.bbclass +++ b/meta/classes-global/sanity.bbclass | |||
@@ -602,6 +602,28 @@ def drop_v14_cross_builds(d): | |||
602 | bb.utils.remove(stamp + "*") | 602 | bb.utils.remove(stamp + "*") |
603 | bb.utils.remove(workdir, recurse = True) | 603 | bb.utils.remove(workdir, recurse = True) |
604 | 604 | ||
605 | def check_cpp_toolchain(d): | ||
606 | """ | ||
607 | it checks if the c++ compiling and linking to libstdc++ works properly in the native system | ||
608 | """ | ||
609 | import shlex | ||
610 | import subprocess | ||
611 | |||
612 | cpp_code = """ | ||
613 | #include <iostream> | ||
614 | int main() { | ||
615 | std::cout << "Hello, World!" << std::endl; | ||
616 | return 0; | ||
617 | } | ||
618 | """ | ||
619 | |||
620 | cmd = shlex.split(d.getVar("BUILD_CXX")) + ["-x", "c++","-", "-o", "/dev/null", "-lstdc++"] | ||
621 | try: | ||
622 | subprocess.run(cmd, input=cpp_code, capture_output=True, text=True, check=True) | ||
623 | return None | ||
624 | except subprocess.CalledProcessError as e: | ||
625 | return f"An unexpected issue occurred during the C++ toolchain check: {str(e)}" | ||
626 | |||
605 | def sanity_handle_abichanges(status, d): | 627 | def sanity_handle_abichanges(status, d): |
606 | # | 628 | # |
607 | # Check the 'ABI' of TMPDIR | 629 | # Check the 'ABI' of TMPDIR |
@@ -770,6 +792,9 @@ def check_sanity_version_change(status, d): | |||
770 | # macOS with default HFS+ file system) | 792 | # macOS with default HFS+ file system) |
771 | status.addresult(check_case_sensitive(tmpdir, "TMPDIR")) | 793 | status.addresult(check_case_sensitive(tmpdir, "TMPDIR")) |
772 | 794 | ||
795 | # Check if linking with lstdc++ is failing | ||
796 | status.addresult(check_cpp_toolchain(d)) | ||
797 | |||
773 | def sanity_check_locale(d): | 798 | def sanity_check_locale(d): |
774 | """ | 799 | """ |
775 | Currently bitbake switches locale to en_US.UTF-8 so check that this locale actually exists. | 800 | Currently bitbake switches locale to en_US.UTF-8 so check that this locale actually exists. |