diff mbox series

toolchain/clang-native: Work around native compiles for some gcc configs

Message ID 20250707213341.4102515-1-richard.purdie@linuxfoundation.org
State New
Headers show
Series toolchain/clang-native: Work around native compiles for some gcc configs | expand

Commit Message

Richard Purdie July 7, 2025, 9:33 p.m. UTC
Some systems can have mixed development headers, such as pieces of both gcc 13
and 14 which can cause build failures, particularly if libgcc and libstdc++ for
gcc 13 are present but only libgcc for gcc 14 and not libstdc++ when the gcc
version is gcc 13.

This patch forces clang to use the full toolchain rather than any partial incomplete
version. It is only necessary in the native case and should also be applicable to
compiler-rt in due source, hence making it an inc file.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
---
 meta/classes/toolchain/clang-native.bbclass | 7 +++++++
 1 file changed, 7 insertions(+)
diff mbox series

Patch

diff --git a/meta/classes/toolchain/clang-native.bbclass b/meta/classes/toolchain/clang-native.bbclass
index 4de491a1cb5..c8b20ff8c40 100644
--- a/meta/classes/toolchain/clang-native.bbclass
+++ b/meta/classes/toolchain/clang-native.bbclass
@@ -16,3 +16,10 @@  BUILD_READELF = "${BUILD_PREFIX}llvm-readelf"
 DEPENDS += "clang-native libcxx-native compiler-rt-native"
 
 LDFLAGS += " --rtlib=libgcc --unwindlib=libgcc"
+
+# Some systems can have mixed gcc development headers, such as pieces of both gcc 13
+# and 14 which can cause build failures, particularly if libgcc and libstdc++ for
+# gcc 13 are present but only libgcc for gcc 14 and not libstdc++ when the gcc
+# version is gcc 13. Force the gcc install that matches gcc itself
+BUILD_CFLAGS:append:class-native = " --gcc-install-dir=$(dirname $(gcc -print-libgcc-file-name))"
+BUILD_CXXFLAGS:append:class-native = " --gcc-install-dir=$(dirname $(gcc -print-libgcc-file-name))"