0019-For-x86_64-set-Yocto-based-GCC-install-search-path.patch 3.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. From ca344d46711d5ce6b5e0f7862b98bbfc7abb7d4c Mon Sep 17 00:00:00 2001
  2. From: Hongxu Jia <hongxu.jia@windriver.com>
  3. Date: Mon, 25 Jan 2021 16:14:35 +0800
  4. Subject: [PATCH] For x86_64, set Yocto based GCC install search path
  5. Under Yocto host, while using clang-native to build, it searches
  6. install host gcc failed which causing the include file not found
  7. [snip]
  8. |clang++ -target x86_64-linux -MMD -MF src/base/files/file_path_constants.o.d -I../../../tools/gn/src -I. \
  9. -isystem/tmp-glibc/work/x86_64-linux/gn-native/87.0.4280.141-r0/recipe-sysroot-native/usr/include -O2 -pipe \
  10. -std=c++17 -c ../../../tools/gn/src/base/files/file_path_constants.cc -o src/base/files/file_path_constants.o
  11. |../../../tools/gn/src/base/files/file_path_constants.cc:7:10: fatal error: 'iterator' file not found
  12. |#include <iterator>
  13. | ^~~~~~~~
  14. [snip]
  15. Set three Yocto based GCC triple: poky, oe-core and wind river
  16. Before aplly the patch
  17. [snip]
  18. $ ../recipe-sysroot-native/usr/bin/clang++ -v
  19. clang version 11.0.1 (https://github.com/llvm/llvm-project 43ff75f2c3feef64f9d73328230d34dac8832a91)
  20. Target: x86_64-unknown-linux-gnu
  21. Thread model: posix
  22. InstalledDir:tmp-glibc/work/x86_64-linux/gn-native/87.0.4280.141-r0/chromium-87.0.4280.141/../recipe-sysroot-native/usr/bin
  23. [snip]
  24. After aplly the patch:
  25. [snip]
  26. $ ../recipe-sysroot-native/usr/bin/clang++ -v
  27. clang version 11.0.1 (https://github.com/llvm/llvm-project 22c3241ff9a6224261df48d0258957fd8acc3d64)
  28. Target: x86_64-unknown-linux-gnu
  29. Thread model: posix
  30. InstalledDir:tmp-glibc/work/x86_64-linux/gn-native/87.0.4280.141-r0/chromium-87.0.4280.141/../recipe-sysroot-native/usr/bin
  31. Found candidate GCC installation: /usr/lib//x86_64-wrs-linux/10.1.0
  32. Found candidate GCC installation: /usr/lib/gcc/x86_64-wrs-linux/10.1.0
  33. Selected GCC installation: /usr/lib//x86_64-wrs-linux/10.1.0
  34. Candidate multilib: .;@m64
  35. Selected multilib: .;@m64
  36. [snip]
  37. BTW, it is hardly to insert a triple by the replacement of TARGET_SYS
  38. (=${TARGET_ARCH}${TARGET_VENDOR}-${TARGET_OS}), since TARGET_VENDOR
  39. is different between clang and clang-native
  40. The //CLANG_EXTRA_OE_VENDORS_TRIPLES string is replaced with list of
  41. additional triples based on CLANG_EXTRA_OE_VENDORS variable in
  42. recipes-devtools/clang/llvm-project-source.inc:add_distro_vendor()
  43. Upstream-Status: Inappropriate [oe specific]
  44. Signed-off-by: Martin Jansa <martin.jansa@gmail.com>
  45. Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
  46. Signed-off-by: Khem Raj <raj.khem@gmail.com>
  47. ---
  48. clang/lib/Driver/ToolChains/Gnu.cpp | 1 +
  49. 1 file changed, 1 insertion(+)
  50. diff --git a/clang/lib/Driver/ToolChains/Gnu.cpp b/clang/lib/Driver/ToolChains/Gnu.cpp
  51. index 846163329d92..0db37c6ef1a8 100644
  52. --- a/clang/lib/Driver/ToolChains/Gnu.cpp
  53. +++ b/clang/lib/Driver/ToolChains/Gnu.cpp
  54. @@ -2254,6 +2254,7 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes(
  55. "x86_64-redhat-linux", "x86_64-suse-linux",
  56. "x86_64-manbo-linux-gnu", "x86_64-linux-gnu",
  57. "x86_64-slackware-linux", "x86_64-unknown-linux",
  58. + "x86_64-oe-linux",//CLANG_EXTRA_OE_VENDORS_TRIPLES
  59. "x86_64-amazon-linux"};
  60. static const char *const X32Triples[] = {"x86_64-linux-gnux32",
  61. "x86_64-pc-linux-gnux32"};