Re: -stdlib=libc++?

2022-04-02 Thread Iain Sandoe
Hi Shivam,

> On 2 Apr 2022, at 06:57, Shivam Gupta  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  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.



Re: -stdlib=libc++?

2022-04-02 Thread Shivam Gupta via Gcc
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  wrote:

> Hi Shivam,
>
> > On 2 Apr 2022, at 06:57, Shivam Gupta  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  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.
>
>


Re: -stdlib=libc++?

2022-04-02 Thread Shivam Gupta via Gcc
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  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  wrote:
>
>> Hi Shivam,
>>
>> > On 2 Apr 2022, at 06:57, Shivam Gupta  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  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.
>>
>>


gcc-11-20220402 is now available

2022-04-02 Thread GCC Administrator via Gcc
Snapshot gcc-11-20220402 is now available on
  https://gcc.gnu.org/pub/gcc/snapshots/11-20220402/
and on various mirrors, see http://gcc.gnu.org/mirrors.html for details.

This snapshot has been generated from the GCC 11 git branch
with the following options: git://gcc.gnu.org/git/gcc.git branch 
releases/gcc-11 revision 5f587c81bc558942d2988f5e2965a72471f5c202

You'll find:

 gcc-11-20220402.tar.xz   Complete GCC

  SHA256=2da5aa7ae438b27987a1ccaf8f779cb4a9c1f7f5ab7f91ae5336aa112b54a985
  SHA1=5c8ee76fedec6ac8112d8a351721ae26045489cf

Diffs from 11-20220326 are available in the diffs/ subdirectory.

When a particular snapshot is ready for public consumption the LATEST-11
link is updated and a message is sent to the gcc list.  Please do not use
a snapshot before it has been announced that way.


Re: -stdlib=libc++?

2022-04-02 Thread Iain Sandoe
Hi Shivam,

> On 2 Apr 2022, at 17:48, Shivam Gupta  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