0021-For-x86_64-set-Yocto-based-GCC-install-search-path.patch 3.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. From 59b5274dccd5bab65df246e812ee22b747916d7d Mon Sep 17 00:00:00 2001
  2. From: Jun Yuan Tan <junyuan.tan@starfivetech.com>
  3. Date: Tue, 9 Nov 2021 10:43:27 +0800
  4. Subject: [PATCH 21/34] 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_more_target_vendors()
  43. Upstream-Status: Inappropriate [oe specific]
  44. Rebased to LLVM 14.0.0 by Jun Yuan Tan
  45. Signed-off-by: Martin Jansa <martin.jansa@gmail.com>
  46. Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
  47. Signed-off-by: Khem Raj <raj.khem@gmail.com>
  48. Signed-off-by: Jun Yuan Tan <junyuan.tan@starfivetech.com>
  49. ---
  50. clang/lib/Driver/ToolChains/Gnu.cpp | 1 +
  51. 1 file changed, 1 insertion(+)
  52. diff --git a/clang/lib/Driver/ToolChains/Gnu.cpp b/clang/lib/Driver/ToolChains/Gnu.cpp
  53. index 31d1c5c756fd..e6f440902e97 100644
  54. --- a/clang/lib/Driver/ToolChains/Gnu.cpp
  55. +++ b/clang/lib/Driver/ToolChains/Gnu.cpp
  56. @@ -2118,6 +2118,7 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes(
  57. "x86_64-redhat-linux", "x86_64-suse-linux",
  58. "x86_64-manbo-linux-gnu", "x86_64-linux-gnu",
  59. "x86_64-slackware-linux", "x86_64-unknown-linux",
  60. + "x86_64-oe-linux",//CLANG_EXTRA_OE_VENDORS_TRIPLES
  61. "x86_64-amazon-linux", "x86_64-linux-android"};
  62. static const char *const X32Triples[] = {"x86_64-linux-gnux32",
  63. "x86_64-pc-linux-gnux32"};
  64. --
  65. 2.33.1