From 6da0abaa33b458a37b97f42e3755245e3220bf27 Mon Sep 17 00:00:00 2001 From: Khem Raj Date: Mon, 10 Mar 2025 13:19:25 -0700 Subject: clang.bbclass,compiler-rt: Do not set -target for native clang When building native recipes using clang as native compiler e.g. compiler-rt-native, setting -target can be out of sync with the underlying distro's understanding of gcc tuple e.g. aarch64-linux or aarch64-linux-gnu, which is used by distros to house the gcc runtime e.g. on ubuntu /usr/lib/gcc/aarch64-linux-gnu/11 /usr/lib/gcc/aarch64-linux-gnu/9 if we provide -target its not able to deduce it from the build host which is required for native packages try with recipe-sysroot-native/usr/bin/clang -xc /dev/null -rtlib=libgcc --unwindlib=libgcc -stdlib=libstdc++ -v or recipe-sysroot-native/usr/bin/clang -xc /dev/null -rtlib=libgcc --unwindlib=libgcc -stdlib=libstdc++ -target aarch64-linux -v to see the difference Signed-off-by: Khem Raj --- classes/clang.bbclass | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'classes/clang.bbclass') diff --git a/classes/clang.bbclass b/classes/clang.bbclass index e9571ce..0671ef6 100644 --- a/classes/clang.bbclass +++ b/classes/clang.bbclass @@ -1,6 +1,7 @@ # Add the necessary override CCACHE_COMPILERCHECK:toolchain-clang ?= "%compiler% -v" -HOST_CC_ARCH:prepend:toolchain-clang = "-target ${HOST_SYS} " +HOST_CC_ARCH:prepend:toolchain-clang:class-target = "-target ${HOST_SYS} " +HOST_CC_ARCH:prepend:toolchain-clang:class-nativesdk = "-target ${HOST_SYS} " CC:toolchain-clang = "${CCACHE}${HOST_PREFIX}clang ${HOST_CC_ARCH}${TOOLCHAIN_OPTIONS}" CXX:toolchain-clang = "${CCACHE}${HOST_PREFIX}clang++ ${HOST_CC_ARCH}${TOOLCHAIN_OPTIONS}" CPP:toolchain-clang = "${CCACHE}${HOST_PREFIX}clang ${HOST_CC_ARCH}${TOOLCHAIN_OPTIONS} -E" -- cgit v1.2.3-54-g00ecf