From 6c4d41100647220b9ccd0c041d617e979afb5f37 Mon Sep 17 00:00:00 2001 From: Martin Jansa Date: Wed, 12 Nov 2025 11:12:50 +0100 Subject: [PATCH] clang.bbclass: add clang-native to BASE_DEFAULT_DEPS Add it for target builds in: BASE_DEFAULT_DEPS:append:class-target:toolchain-clang:class-target because ${MLPREFIX}clang-cross-${TARGET_ARCH} contains a broken symlink to clang binary provided by clang-native and then in case someone changes e.g. TC_CXX_RUNTIME = "llvm" to TC_CXX_RUNTIME:class-target = "llvm" then both clang-native and clang-cross-${TARGET_ARCH} are correctly rebuilt, but unfortunately the hashequiv output hash of clang-cross-${TARGET_ARCH} doesn't change (because the broken symlink is still the same), so e.g. gptfdisk which depends on "equivalent" clang-cross from BASE_DEFAULT_DEPS doesn't get rebuilt, but then it still links with libc++.so.1 while in clean build without sstate and hashequiv it will link with libstdc++.so.6 (because TC_CXX_RUNTIME affects only clang-native and the override for class-target doesn't work as one might expect). This might need some bigger changes in hashequiv to have special handlink of broken symlinks in the output, if the symlink target is provided by some dependency, we should include the hash of the symlink target to make sure the outhash changes even when something deeper in dependency tree changed the target binary (or error out when there is no direct dependency of the provider). clang-cross from oe-core master doesn't have this issue, because it contains the actual binary from clang-native after: https://github.com/openembedded/openembedded-core/commit/3b0128fe6421e64674fd250e0b4e6afb1c8ce436 so the outhash is changed when this binary is changed. Signed-off-by: Martin Jansa --- classes/clang.bbclass | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/classes/clang.bbclass b/classes/clang.bbclass index 304a78d2..5a4db099 100644 --- a/classes/clang.bbclass +++ b/classes/clang.bbclass @@ -114,7 +114,7 @@ YOCTO_ALTERNATE_LIBDIR:toolchain-clang:class-target = "/${BASELIB}" def clang_base_deps(d): if not d.getVar('INHIBIT_DEFAULT_DEPS', False): if not oe.utils.inherits(d, 'allarch') : - ret = " ${MLPREFIX}clang-cross-${TARGET_ARCH} virtual/libc " + ret = " clang-native ${MLPREFIX}clang-cross-${TARGET_ARCH} virtual/libc " if (d.getVar('TC_CXX_RUNTIME').find('android') != -1): ret += " libcxx" return ret