From 59b5274dccd5bab65df246e812ee22b747916d7d Mon Sep 17 00:00:00 2001 From: Jun Yuan Tan Date: Tue, 9 Nov 2021 10:43:27 +0800 Subject: [PATCH 21/34] For x86_64, set Yocto based GCC install search path Under Yocto host, while using clang-native to build, it searches install host gcc failed which causing the include file not found [snip] |clang++ -target x86_64-linux -MMD -MF src/base/files/file_path_constants.o.d -I../../../tools/gn/src -I. \ -isystem/tmp-glibc/work/x86_64-linux/gn-native/87.0.4280.141-r0/recipe-sysroot-native/usr/include -O2 -pipe \ -std=c++17 -c ../../../tools/gn/src/base/files/file_path_constants.cc -o src/base/files/file_path_constants.o |../../../tools/gn/src/base/files/file_path_constants.cc:7:10: fatal error: 'iterator' file not found |#include | ^~~~~~~~ [snip] Set three Yocto based GCC triple: poky, oe-core and wind river Before aplly the patch [snip] $ ../recipe-sysroot-native/usr/bin/clang++ -v clang version 11.0.1 (https://github.com/llvm/llvm-project 43ff75f2c3feef64f9d73328230d34dac8832a91) Target: x86_64-unknown-linux-gnu Thread model: posix InstalledDir:tmp-glibc/work/x86_64-linux/gn-native/87.0.4280.141-r0/chromium-87.0.4280.141/../recipe-sysroot-native/usr/bin [snip] After aplly the patch: [snip] $ ../recipe-sysroot-native/usr/bin/clang++ -v clang version 11.0.1 (https://github.com/llvm/llvm-project 22c3241ff9a6224261df48d0258957fd8acc3d64) Target: x86_64-unknown-linux-gnu Thread model: posix InstalledDir:tmp-glibc/work/x86_64-linux/gn-native/87.0.4280.141-r0/chromium-87.0.4280.141/../recipe-sysroot-native/usr/bin Found candidate GCC installation: /usr/lib//x86_64-wrs-linux/10.1.0 Found candidate GCC installation: /usr/lib/gcc/x86_64-wrs-linux/10.1.0 Selected GCC installation: /usr/lib//x86_64-wrs-linux/10.1.0 Candidate multilib: .;@m64 Selected multilib: .;@m64 [snip] BTW, it is hardly to insert a triple by the replacement of TARGET_SYS (=${TARGET_ARCH}${TARGET_VENDOR}-${TARGET_OS}), since TARGET_VENDOR is different between clang and clang-native The //CLANG_EXTRA_OE_VENDORS_TRIPLES string is replaced with list of additional triples based on CLANG_EXTRA_OE_VENDORS variable in recipes-devtools/clang/llvm-project-source.inc:add_more_target_vendors() Upstream-Status: Inappropriate [oe specific] Rebased to LLVM 14.0.0 by Jun Yuan Tan Signed-off-by: Martin Jansa Signed-off-by: Hongxu Jia Signed-off-by: Khem Raj Signed-off-by: Jun Yuan Tan --- clang/lib/Driver/ToolChains/Gnu.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/clang/lib/Driver/ToolChains/Gnu.cpp b/clang/lib/Driver/ToolChains/Gnu.cpp index 31d1c5c756fd..e6f440902e97 100644 --- a/clang/lib/Driver/ToolChains/Gnu.cpp +++ b/clang/lib/Driver/ToolChains/Gnu.cpp @@ -2118,6 +2118,7 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes( "x86_64-redhat-linux", "x86_64-suse-linux", "x86_64-manbo-linux-gnu", "x86_64-linux-gnu", "x86_64-slackware-linux", "x86_64-unknown-linux", + "x86_64-oe-linux",//CLANG_EXTRA_OE_VENDORS_TRIPLES "x86_64-amazon-linux", "x86_64-linux-android"}; static const char *const X32Triples[] = {"x86_64-linux-gnux32", "x86_64-pc-linux-gnux32"}; -- 2.33.1