<div dir="ltr"><div>Hi Shoaib,</div><div><br></div>We have a similar problem in Chrome OS SDK ( <a href="https://bugs.chromium.org/p/chromium/issues/detail?id=948440">https://bugs.chromium.org/p/chromium/issues/detail?id=948440</a> ) <div>where we have libc++ headers installed for use in host while there are target specific libc++ headers installed in</div><div>different locations. The host headers are picked even though we specify --sysroot to point to target builds.</div><div> </div><div>This hasn't been a major problem for us though since libc++ headers are identical as long we</div><div>use the same version of libc++.</div><div><br></div><div>As for the choices: My preference is for a new flag but don't have a naming preference.</div><div><br></div><div>Thanks,</div><div>Manoj</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Jun 26, 2019 at 2:26 PM Shoaib Meenai 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 lang="EN-US">
<div class="gmail-m_8279802284666328924WordSection1">
<p class="MsoNormal"><span style="font-size:11pt">If you’re building with -stdlib=libc++, the Linux toolchain (which is used for e.g. Android) prefers libc++ headers installed alongside the compiler to those in the sysroot:
<a href="https://github.com/llvm/llvm-project/blob/d5f7196feb7da50564c5ad444f5fd3fecf08f340/clang/lib/Driver/ToolChains/Linux.cpp#L892" target="_blank">
https://github.com/llvm/llvm-project/blob/d5f7196feb7da50564c5ad444f5fd3fecf08f340/clang/lib/Driver/ToolChains/Linux.cpp#L892</a>. I have a use case where this doesn’t work: the Android NDK’s version of libc++ uses a different inline namespace, so I want to
 pair it with the corresponding headers from the sysroot, even though my toolchain also contains libc++ headers (for use with other platforms).<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt">I’m looking for a way to turn off searching for libc++ headers installed alongside the compiler but still search for them in the sysroot. The closest I can get right now is building with -nostdinc++ and adding
 a manual -isystem for the sysroot’s libc++ header directory, but that breaks compiles that want to use -nostdinc++ themselves and specify an alternate libc++ header location (since my -isystem will always be present, so you’ll end up with two copies of the
 libc++ headers in your search paths and everything will break).<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt">I can think of two ways to accomplish this. One is to add a new flag (and I’m looking for naming suggestions for this flag) to turn off searching for libc++ headers installed alongside the compiler. The other
 is to promote -cxx-isystem to a driver option, inhibit any -cxx-isystem paths from being added to the search paths when -nostdinc++ is passed, and make sure -cxx-isystem gets put on the include path before everything else (since C++ headers usually #include_next
 into other system headers). What’s the best option here?<u></u><u></u></span></p>
</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>