Hi Iain,

Thank again for the detailed reply, understood now.

Shivam


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

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

Reply via email to