summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristos Gavros <gavrosc@yahoo.com>2025-01-26 11:02:25 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2025-01-27 15:47:11 +0000
commit0ddac246e198d37fcab80f2aeb75b333141494d2 (patch)
tree52abfc0c062607a6c5c1ca59fd2b10045e490f62
parent174e7c82291032a6d315ea3d700687468a3b916b (diff)
downloadpoky-0ddac246e198d37fcab80f2aeb75b333141494d2.tar.gz
sanity: Add test for functional c++ toolchain
Users reported issues caused by missing the right libstdc++-version-dev. A new function 'check_cpp_toolchain' added in sanity.bbclass to test linking libstdc++ [YOCTO #15712] (From OE-Core rev: 611c1a26212dfbfe8d0640d9fefe5df49f7b69b8) Signed-off-by: Christos Gavros <gavrosc@yahoo.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/classes-global/sanity.bbclass25
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
605def 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
605def sanity_handle_abichanges(status, d): 627def 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
773def sanity_check_locale(d): 798def 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.