public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Re: -stdlib=libc++?
       [not found] <CAHX=PX-2PEZ8iPrpmneDYoUSBDthPjjuxckEcFnpyXsoSdwO2w@mail.gmail.com>
@ 2022-04-02  9:51 ` Iain Sandoe
  2022-04-02 14:02   ` -stdlib=libc++? Shivam Gupta
  0 siblings, 1 reply; 7+ messages in thread
From: Iain Sandoe @ 2022-04-02  9:51 UTC (permalink / raw)
  To: Shivam Gupta; +Cc: unlvsur unlvsur, GCC Development

Hi Shivam,

> On 2 Apr 2022, at 06:57, Shivam Gupta <shivam98.tkg@gmail.com> wrote:
> 
> I saw your last year's mail for the same topic on the GCC mailing list -https://gcc.gnu.org/pipermail/gcc/2020-March/000230.html.

The patch was applied to GCC-11 (so is available one GCC-11 branch and will be on GCC-12 when that is released).
> 
> I tried today but this option is still not available.

The option has to be configured when the compiler is built, that also means that you have to install (and point the configure to) a suitable set of libc++ headers from the LLVM project  (e.g. there is a set here: https://github.com/iains/llvm-project/tree/9.0.1-gcc-stdlib).

Generally, GCC is very compatible with the libc++ headers (the changes I made on that branch were mostly to deal with <coroutine> being in std:: for GCC and std::experimental:: for LLVM-9).  For LLVM libc++ earlier than 9 there is a missing symbol that GCC uses - but that can be worked around too.

There have been some changes in more recent (in particular, LLVM-14/main) libc++ that should make it more compatible.

Of course, you should pick a version of the libc++ headers than matches the version used on your system (9 was used for quite a long time, but recent xcode headers are newer).

Given that this involves cross-project sources and choosing a suitable set, probably it is a job for the distributions (e.g. homebrew, macports etc) to arrange or, for self-built compilers, following in the general comments above.

FWIW, I have used this to build quite a few OSS projects on a number of Darwin versions (hence the comment about GCC being very compatible with libc++).

thanks,
Iain.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: -stdlib=libc++?
  2022-04-02  9:51 ` -stdlib=libc++? Iain Sandoe
@ 2022-04-02 14:02   ` Shivam Gupta
  2022-04-02 16:48     ` -stdlib=libc++? Shivam Gupta
  0 siblings, 1 reply; 7+ messages in thread
From: Shivam Gupta @ 2022-04-02 14:02 UTC (permalink / raw)
  To: Iain Sandoe; +Cc: unlvsur unlvsur, GCC Development

Hi Iain,

Thank you for the quick response and the effort to make that feature
available.

When I reconfigured/build GCC
with --with-gxx-libcxx-include-dir=/usr/include/c++/v1/ , -stdlib= option
is now available to take libc++.

thanks,
Shivam.

On Sat, Apr 2, 2022 at 3:21 PM Iain Sandoe <iain@sandoe.co.uk> wrote:

> Hi Shivam,
>
> > On 2 Apr 2022, at 06:57, Shivam Gupta <shivam98.tkg@gmail.com> wrote:
> >
> > I saw your last year's mail for the same topic on the GCC mailing list -
> https://gcc.gnu.org/pipermail/gcc/2020-March/000230.html.
>
> The patch was applied to GCC-11 (so is available one GCC-11 branch and
> will be on GCC-12 when that is released).
> >
> > I tried today but this option is still not available.
>
> The option has to be configured when the compiler is built, that also
> means that you have to install (and point the configure to) a suitable set
> of libc++ headers from the LLVM project  (e.g. there is a set here:
> https://github.com/iains/llvm-project/tree/9.0.1-gcc-stdlib).
>
> Generally, GCC is very compatible with the libc++ headers (the changes I
> made on that branch were mostly to deal with <coroutine> being in std:: for
> GCC and std::experimental:: for LLVM-9).  For LLVM libc++ earlier than 9
> there is a missing symbol that GCC uses - but that can be worked around too.
>
> There have been some changes in more recent (in particular, LLVM-14/main)
> libc++ that should make it more compatible.
>
> Of course, you should pick a version of the libc++ headers than matches
> the version used on your system (9 was used for quite a long time, but
> recent xcode headers are newer).
>
> Given that this involves cross-project sources and choosing a suitable
> set, probably it is a job for the distributions (e.g. homebrew, macports
> etc) to arrange or, for self-built compilers, following in the general
> comments above.
>
> FWIW, I have used this to build quite a few OSS projects on a number of
> Darwin versions (hence the comment about GCC being very compatible with
> libc++).
>
> thanks,
> Iain.
>
>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: -stdlib=libc++?
  2022-04-02 14:02   ` -stdlib=libc++? Shivam Gupta
@ 2022-04-02 16:48     ` Shivam Gupta
  2022-04-03  6:53       ` -stdlib=libc++? Iain Sandoe
  0 siblings, 1 reply; 7+ messages in thread
From: Shivam Gupta @ 2022-04-02 16:48 UTC (permalink / raw)
  To: Iain Sandoe; +Cc: unlvsur unlvsur, GCC Development

Hi Iain,

May I ask why we need to specify  --with-gxx-libcxx-include-dir= at
compile/configure time of GCC? While in clang equivalent, -stdlib= doesn't
require so.

thanks,
Shivam

On Sat, Apr 2, 2022 at 7:32 PM Shivam Gupta <shivam98.tkg@gmail.com> wrote:

> Hi Iain,
>
> Thank you for the quick response and the effort to make that feature
> available.
>
> When I reconfigured/build GCC
> with --with-gxx-libcxx-include-dir=/usr/include/c++/v1/ , -stdlib= option
> is now available to take libc++.
>
> thanks,
> Shivam.
>
> On Sat, Apr 2, 2022 at 3:21 PM Iain Sandoe <iain@sandoe.co.uk> wrote:
>
>> Hi Shivam,
>>
>> > On 2 Apr 2022, at 06:57, Shivam Gupta <shivam98.tkg@gmail.com> wrote:
>> >
>> > I saw your last year's mail for the same topic on the GCC mailing list -
>> https://gcc.gnu.org/pipermail/gcc/2020-March/000230.html.
>>
>> The patch was applied to GCC-11 (so is available one GCC-11 branch and
>> will be on GCC-12 when that is released).
>> >
>> > I tried today but this option is still not available.
>>
>> The option has to be configured when the compiler is built, that also
>> means that you have to install (and point the configure to) a suitable set
>> of libc++ headers from the LLVM project  (e.g. there is a set here:
>> https://github.com/iains/llvm-project/tree/9.0.1-gcc-stdlib).
>>
>> Generally, GCC is very compatible with the libc++ headers (the changes I
>> made on that branch were mostly to deal with <coroutine> being in std:: for
>> GCC and std::experimental:: for LLVM-9).  For LLVM libc++ earlier than 9
>> there is a missing symbol that GCC uses - but that can be worked around too.
>>
>> There have been some changes in more recent (in particular, LLVM-14/main)
>> libc++ that should make it more compatible.
>>
>> Of course, you should pick a version of the libc++ headers than matches
>> the version used on your system (9 was used for quite a long time, but
>> recent xcode headers are newer).
>>
>> Given that this involves cross-project sources and choosing a suitable
>> set, probably it is a job for the distributions (e.g. homebrew, macports
>> etc) to arrange or, for self-built compilers, following in the general
>> comments above.
>>
>> FWIW, I have used this to build quite a few OSS projects on a number of
>> Darwin versions (hence the comment about GCC being very compatible with
>> libc++).
>>
>> thanks,
>> Iain.
>>
>>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: -stdlib=libc++?
  2022-04-02 16:48     ` -stdlib=libc++? Shivam Gupta
@ 2022-04-03  6:53       ` Iain Sandoe
  2022-04-03  8:03         ` -stdlib=libc++? Shivam Gupta
  0 siblings, 1 reply; 7+ messages in thread
From: Iain Sandoe @ 2022-04-03  6:53 UTC (permalink / raw)
  To: Shivam Gupta; +Cc: unlvsur unlvsur, GCC Development

Hi Shivam,

> On 2 Apr 2022, at 17:48, Shivam Gupta <shivam98.tkg@gmail.com> wrote:
> 

> May I ask why we need to specify  --with-gxx-libcxx-include-dir= at compile/configure time of GCC?

The libc++ headers are not part of a base system install (on Darwin they are part of either Xcode or Command Line Tools installations). On other platforms, they will be an optional install.  It seems unhelpful to enable an option that will not work (without knowing where to find the headers, -stdlib=libc++ cannot work).

For GCC, the default is to use -stdlib=libstdc++, and that is part of the compiler’s install so that it can be located without extra configuration, and it does not require the -stdlib option to work.

> While in clang equivalent, -stdlib= doesn't require so.

libc++ is the default for clang and is part of the standard compiler distribution (so it can be located without additional configuration).

OTOH, I believe that you will find that to make -stdlib=libstdc++ work will generally require some cmake values to point to the GCC installation (On macOS/Darwin there is a default that points to the old apple-gcc-4.2.1 installation [for Darwin11-16], but that is not necessarily the GCC version you would be using there, either).

In summary, since neither compiler “knows” where to find the other, some configuration is required in the general case to find the non-native C++ runtime.

Iain


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: -stdlib=libc++?
  2022-04-03  6:53       ` -stdlib=libc++? Iain Sandoe
@ 2022-04-03  8:03         ` Shivam Gupta
  0 siblings, 0 replies; 7+ messages in thread
From: Shivam Gupta @ 2022-04-03  8:03 UTC (permalink / raw)
  To: Iain Sandoe; +Cc: GCC Development, unlvsur unlvsur

Hi Iain,

Thank again for the detailed reply, understood now.

Shivam


On Sun, 3 Apr 2022 at 12:23 PM, Iain Sandoe <iain@sandoe.co.uk> wrote:

> Hi Shivam,
>
> > On 2 Apr 2022, at 17:48, Shivam Gupta <shivam98.tkg@gmail.com> wrote:
> >
>
> > May I ask why we need to specify  --with-gxx-libcxx-include-dir= at
> compile/configure time of GCC?
>
> The libc++ headers are not part of a base system install (on Darwin they
> are part of either Xcode or Command Line Tools installations). On other
> platforms, they will be an optional install.  It seems unhelpful to enable
> an option that will not work (without knowing where to find the headers,
> -stdlib=libc++ cannot work).
>
> For GCC, the default is to use -stdlib=libstdc++, and that is part of the
> compiler’s install so that it can be located without extra configuration,
> and it does not require the -stdlib option to work.
>
> > While in clang equivalent, -stdlib= doesn't require so.
>
> libc++ is the default for clang and is part of the standard compiler
> distribution (so it can be located without additional configuration).
>
> OTOH, I believe that you will find that to make -stdlib=libstdc++ work
> will generally require some cmake values to point to the GCC installation
> (On macOS/Darwin there is a default that points to the old apple-gcc-4.2.1
> installation [for Darwin11-16], but that is not necessarily the GCC version
> you would be using there, either).
>
> In summary, since neither compiler “knows” where to find the other, some
> configuration is required in the general case to find the non-native C++
> runtime.
>
> Iain
>
>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: -stdlib=libc++?
  2020-03-30 14:19 -stdlib=libc++? unlvsur unlvsur
@ 2020-03-30 14:42 ` Iain Sandoe
  0 siblings, 0 replies; 7+ messages in thread
From: Iain Sandoe @ 2020-03-30 14:42 UTC (permalink / raw)
  To: unlvsur unlvsur; +Cc: gcc

unlvsur unlvsur via Gcc <gcc@gcc.gnu.org> wrote:

> I think this would be great to support LLVM’s libc++ by be compatible  
> with -stdlib=libc++ on clang.

I have a patch for this, for next stage 1.

(we are in stage 4 now, so not the right time for new features).

thanks
Iain


^ permalink raw reply	[flat|nested] 7+ messages in thread

* -stdlib=libc++?
@ 2020-03-30 14:19 unlvsur unlvsur
  2020-03-30 14:42 ` -stdlib=libc++? Iain Sandoe
  0 siblings, 1 reply; 7+ messages in thread
From: unlvsur unlvsur @ 2020-03-30 14:19 UTC (permalink / raw)
  To: gcc

I think this would be great to support LLVM’s libc++ by be compatible with -stdlib=libc++ on clang.

Sent from Mail<https://go.microsoft.com/fwlink/?LinkId=550986> for Windows 10


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2022-04-03  8:03 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <CAHX=PX-2PEZ8iPrpmneDYoUSBDthPjjuxckEcFnpyXsoSdwO2w@mail.gmail.com>
2022-04-02  9:51 ` -stdlib=libc++? Iain Sandoe
2022-04-02 14:02   ` -stdlib=libc++? Shivam Gupta
2022-04-02 16:48     ` -stdlib=libc++? Shivam Gupta
2022-04-03  6:53       ` -stdlib=libc++? Iain Sandoe
2022-04-03  8:03         ` -stdlib=libc++? Shivam Gupta
2020-03-30 14:19 -stdlib=libc++? unlvsur unlvsur
2020-03-30 14:42 ` -stdlib=libc++? Iain Sandoe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).