[cfe-dev] Inconsistent libc++ search paths

Evgenii Stepanov via cfe-dev cfe-dev at lists.llvm.org
Fri Feb 22 15:20:01 PST 2019


Hi,

in lib/Driver/ToolChains/Linux.cpp, the search order for libc++
headers and libraries seems inconsistent.

Headers are searched in
1. Resource dir
2. Driver dir
3. %sysroot/usr/include/c++

Libraries are searched in
1. Driver dir only if it is under sysroot (!)
2. %sysroot/lib
3. %sysroot/usr/lib

When building with what Linux::addLibCxxIncludePaths calls
"development, non-installed" clang and a sysroot (ex. I'm using one
from Android NDK) where both locations have a copy of libc++, clang
picks libc++ headers from its resource dir, and an incompatible
library from sysroot.

Comments around the library search code suggest that the order should
not be changed. Does it make sense to tweak the headers search order
to match? That way building with local libc++ and a sysroot would
require extra flags (because clang would default to sysroot headers),
but that is already the case for the -shared-libc++ case.



More information about the cfe-dev mailing list