From d249ebabcd4e0350acf3595f80160110cb0ab56d Mon Sep 17 00:00:00 2001 From: Khem Raj 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 --- 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 0db37c6ef1a8..80a21d58c86c 100644 --- a/clang/lib/Driver/ToolChains/Gnu.cpp +++ b/clang/lib/Driver/ToolChains/Gnu.cpp @@ -3093,7 +3093,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