<div dir="ltr"><div dir="ltr"><div dir="ltr"><div></div><div>Definitely a bug, not sure what should be the right fix (match includes with libraries, the other way around or something in between), but wanted to point out another oddity in described driver behavior.</div><div>We should not use -resource-dir for anything other than the internal clang headers, tools like clang-tidy or clangd rely on this to override the internal headers without overriding the C++ standard library.</div><div><br></div><div>On Sat, Feb 23, 2019 at 1:01 AM Dan Albert via cfe-dev <<a href="mailto:cfe-dev@lists.llvm.org">cfe-dev@lists.llvm.org</a>> wrote:<br></div></div></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><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></blockquote><div dir="ltr">I don't think that's the case. The search paths for libc++ on MacOS are handled in "lib/Driver/ToolChains/Darwin.cpp" in DarwinClang::AddClangCXXStdlibIncludeArgs.</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div></div><div>From the NDK side of things, changing the libc++ header search to match the libc++ library search should be fine.<br></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" target="_blank">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>
_______________________________________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a><br>
<a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev" rel="noreferrer" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev</a><br>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div>Regards,</div><div>Ilya Biryukov</div></div></div></div></div></div>