<div dir="ltr">Maybe the reason they differ is so you get new libc++ headers but still use the system dylib by default on Mac? I know that's a use case that's fairly carefully maintained, but idk if it's intended to be the default.<div></div><div><br></div><div>From the NDK side of things, changing the libc++ header search to match the libc++ library search should be fine.</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Feb 22, 2019 at 3:20 PM Evgenii Stepanov <<a href="mailto:eugeni.stepanov@gmail.com">eugeni.stepanov@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi,<br>
<br>
in lib/Driver/ToolChains/Linux.cpp, the search order for libc++<br>
headers and libraries seems inconsistent.<br>
<br>
Headers are searched in<br>
1. Resource dir<br>
2. Driver dir<br>
3. %sysroot/usr/include/c++<br>
<br>
Libraries are searched in<br>
1. Driver dir only if it is under sysroot (!)<br>
2. %sysroot/lib<br>
3. %sysroot/usr/lib<br>
<br>
When building with what Linux::addLibCxxIncludePaths calls<br>
"development, non-installed" clang and a sysroot (ex. I'm using one<br>
from Android NDK) where both locations have a copy of libc++, clang<br>
picks libc++ headers from its resource dir, and an incompatible<br>
library from sysroot.<br>
<br>
Comments around the library search code suggest that the order should<br>
not be changed. Does it make sense to tweak the headers search order<br>
to match? That way building with local libc++ and a sysroot would<br>
require extra flags (because clang would default to sysroot headers),<br>
but that is already the case for the -shared-libc++ case.<br>
</blockquote></div>