0025-clang-Do-not-use-install-relative-libc-headers.patch 1.4 KB

1234567891011121314151617181920212223242526272829303132
  1. From d249ebabcd4e0350acf3595f80160110cb0ab56d Mon Sep 17 00:00:00 2001
  2. From: Khem Raj <raj.khem@gmail.com>
  3. Date: Wed, 11 Aug 2021 18:37:11 -0700
  4. Subject: [PATCH] clang: Do not use install relative libc++ headers
  5. In OE we use same clang for native and cross builds, therefore we need
  6. to ensure that native sysroot install of libc++ is not searched for
  7. headers when doing cross compile instead it searches the target sysroot
  8. this is especially troublesome when libcxx-native is staged along with
  9. libcxx e.g. chromium
  10. Upstream-Status: Pending
  11. Signed-off-by: Khem Raj <raj.khem@gmail.com>
  12. ---
  13. clang/lib/Driver/ToolChains/Gnu.cpp | 4 +++-
  14. 1 file changed, 3 insertions(+), 1 deletion(-)
  15. diff --git a/clang/lib/Driver/ToolChains/Gnu.cpp b/clang/lib/Driver/ToolChains/Gnu.cpp
  16. index 0db37c6ef1a8..80a21d58c86c 100644
  17. --- a/clang/lib/Driver/ToolChains/Gnu.cpp
  18. +++ b/clang/lib/Driver/ToolChains/Gnu.cpp
  19. @@ -3093,7 +3093,9 @@ Generic_GCC::addLibCxxIncludePaths(const llvm::opt::ArgList &DriverArgs,
  20. // Android never uses the libc++ headers installed alongside the toolchain,
  21. // which are generally incompatible with the NDK libraries anyway.
  22. - if (!getTriple().isAndroid())
  23. + // And also do not add it when --sysroot is specified, since it would expect
  24. + // libc++ headers from sysroot
  25. + if (!getTriple().isAndroid() && SysRoot.empty())
  26. if (AddIncludePath(getDriver().Dir + "/../include"))
  27. return;
  28. // If this is a development, non-installed, clang, libcxx will