<div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div>This is already unified, but only for the per-target runtime layout (LLVM's CMake build uses that layout when you set the LLVM_ENABLE_PER_TARGET_RUNTIME_DIR option).</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Feb 25, 2019 at 1:17 AM Ilya Biryukov via cfe-dev <<a href="mailto:cfe-dev@lists.llvm.org">cfe-dev@lists.llvm.org</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"><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></div></div></blockquote><div><br></div><div>There seems to be an overlap between <a href="http://lists.llvm.org/pipermail/cfe-dev/2019-February/061307.html">http://lists.llvm.org/pipermail/cfe-dev/2019-February/061307.html</a> which has the discussion on where to place different libraries and headers. We should consider unifying the two discussions.</div><div> </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 dir="ltr"><div dir="ltr"><div>On Sat, Feb 23, 2019 at 1:01 AM Dan Albert via cfe-dev <<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">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></div></blockquote><div><br></div><div>On Darwin Clang prefers libc++ headers from Clang but always uses system libc++. I tried to change that in D45639 and make it behave like other platforms but I've been told that this is WAI.</div><div><br></div><div>I still think it's unfortunate because it requires solutions like `-nostdlib++ libc++.a libc++abi.a libunwind.a` to use libc++ that comes with Clang instead of the system one (we also cannot combine these into a single library because D44671 never landed). </div><div> </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 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"><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></blockquote></div></blockquote></div></div></blockquote><div><br></div><div>The first one will be Resource dir, but only if you're using the per-target runtime layout. In that case the first location that's searched is lib/clang/9.0.0/<target>/lib.</div><div> </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 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 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">
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-m_-5775936775811919881gmail_signature"><div dir="ltr"><div><div dir="ltr"><div>Regards,</div><div>Ilya Biryukov</div></div></div></div></div></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></div></div></div></div></div></div></div></div></div>