From 21cdaa9e3e8ec001d3f2de9a6e1e142c1b67066a Mon Sep 17 00:00:00 2001 From: Jun Yuan Tan Date: Tue, 9 Nov 2021 11:07:52 +0800 Subject: [PATCH 33/34] 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 Rebased to LLVM 14.0.0 by Jun Yuan Tan Signed-off-by: Khem Raj Signed-off-by: Jun Yuan Tan --- 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 e6f440902e97..fc65d92e8ea0 100644 --- a/clang/lib/Driver/ToolChains/Gnu.cpp +++ b/clang/lib/Driver/ToolChains/Gnu.cpp @@ -2934,7 +2934,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 -- 2.33.1