mirror of
https://git.yoctoproject.org/poky
synced 2026-05-31 12:49:46 +00:00
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>
This commit is contained in:
committed by
Richard Purdie
parent
174e7c8229
commit
0ddac246e1
@@ -602,6 +602,28 @@ def drop_v14_cross_builds(d):
|
|||||||
bb.utils.remove(stamp + "*")
|
bb.utils.remove(stamp + "*")
|
||||||
bb.utils.remove(workdir, recurse = True)
|
bb.utils.remove(workdir, recurse = True)
|
||||||
|
|
||||||
|
def check_cpp_toolchain(d):
|
||||||
|
"""
|
||||||
|
it checks if the c++ compiling and linking to libstdc++ works properly in the native system
|
||||||
|
"""
|
||||||
|
import shlex
|
||||||
|
import subprocess
|
||||||
|
|
||||||
|
cpp_code = """
|
||||||
|
#include <iostream>
|
||||||
|
int main() {
|
||||||
|
std::cout << "Hello, World!" << std::endl;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
|
||||||
|
cmd = shlex.split(d.getVar("BUILD_CXX")) + ["-x", "c++","-", "-o", "/dev/null", "-lstdc++"]
|
||||||
|
try:
|
||||||
|
subprocess.run(cmd, input=cpp_code, capture_output=True, text=True, check=True)
|
||||||
|
return None
|
||||||
|
except subprocess.CalledProcessError as e:
|
||||||
|
return f"An unexpected issue occurred during the C++ toolchain check: {str(e)}"
|
||||||
|
|
||||||
def sanity_handle_abichanges(status, d):
|
def sanity_handle_abichanges(status, d):
|
||||||
#
|
#
|
||||||
# Check the 'ABI' of TMPDIR
|
# Check the 'ABI' of TMPDIR
|
||||||
@@ -770,6 +792,9 @@ def check_sanity_version_change(status, d):
|
|||||||
# macOS with default HFS+ file system)
|
# macOS with default HFS+ file system)
|
||||||
status.addresult(check_case_sensitive(tmpdir, "TMPDIR"))
|
status.addresult(check_case_sensitive(tmpdir, "TMPDIR"))
|
||||||
|
|
||||||
|
# Check if linking with lstdc++ is failing
|
||||||
|
status.addresult(check_cpp_toolchain(d))
|
||||||
|
|
||||||
def sanity_check_locale(d):
|
def sanity_check_locale(d):
|
||||||
"""
|
"""
|
||||||
Currently bitbake switches locale to en_US.UTF-8 so check that this locale actually exists.
|
Currently bitbake switches locale to en_US.UTF-8 so check that this locale actually exists.
|
||||||
|
|||||||
Reference in New Issue
Block a user