[prev in list] [next in list] [prev in thread] [next in thread] 

List:       cfe-dev
Subject:    Re: [cfe-dev] Controlling usage of libc++ headers installed alongside the compiler
From:       Manoj Gupta via cfe-dev <cfe-dev () lists ! llvm ! org>
Date:       2019-06-27 1:58:31
Message-ID: CAH=Qcsg4hsSVZo07msayqme8wmssHRo+Tguq=cfkjP5pNidJXQ () mail ! gmail ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


Hi Shoaib,

We have a similar problem in Chrome OS SDK (
https://bugs.chromium.org/p/chromium/issues/detail?id=948440 )
where we have libc++ headers installed for use in host while there are
target specific libc++ headers installed in
different locations. The host headers are picked even though we specify
--sysroot to point to target builds.

This hasn't been a major problem for us though since libc++ headers are
identical as long we
use the same version of libc++.

As for the choices: My preference is for a new flag but don't have a naming
preference.

Thanks,
Manoj

On Wed, Jun 26, 2019 at 2:26 PM Shoaib Meenai via cfe-dev <
cfe-dev@lists.llvm.org> wrote:

> 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:
> https://github.com/llvm/llvm-project/blob/d5f7196feb7da50564c5ad444f5fd3fecf08f340/clang/lib/Driver/ToolChains/Linux.cpp#L892.
>  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).
> 
> 
> 
> 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).
> 
> 
> 
> 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?
> _______________________________________________
> cfe-dev mailing list
> cfe-dev@lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
> 


[Attachment #5 (text/html)]

<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&#39;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&#39;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 &lt;<a \
href="mailto:cfe-dev@lists.llvm.org">cfe-dev@lists.llvm.org</a>&gt; \
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>


[Attachment #6 (text/plain)]

_______________________________________________
cfe-dev mailing list
cfe-dev@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic