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