From: Jonathan Wakely <jwakely.gcc@gmail.com>
To: "Ludovic Courtès" <ludovic.courtes@inria.fr>
Cc: gcc-help <gcc-help@gcc.gnu.org>
Subject: Re: libstdc++ search path while building GCC
Date: Tue, 28 Jul 2020 15:21:37 +0100 [thread overview]
Message-ID: <CAH6eHdQ=FQZW7T-OUjEbSWrzEFBULa87ub72Y91K3chOdUOn_Q@mail.gmail.com> (raw)
In-Reply-To: <87eeovu3n7.fsf@inria.fr>
On Tue, 28 Jul 2020 at 15:15, Ludovic Courtès <ludovic.courtes@inria.fr> wrote:
>
> Hi,
>
> Jonathan Wakely <jwakely.gcc@gmail.com> skribis:
>
> > On Wed, 22 Jul 2020 at 21:39, Ludovic Courtès <ludovic.courtes@inria.fr> wrote:
> >>
> >> Hello,
> >>
> >> While building GCC on a non-FHS distro, we do something like¹:
> >>
> >> export CPLUS_INCLUDE_PATH=/path/to/host/gcc/include/c++:/path/to/host/gcc/include
> >
> > That looks wrong. Why are you doing this? Doesn't your host GCC
> > already know where its headers are?
>
> It does. With Guix, CPLUS_INCLUDE_PATH is automatically populated with
> all the include/ and include/c++/ directories of dependencies, which
> includes GCC’s own libstdc++. We could override that, but I’m trying to
> understand what’s going on.
>
> >> This ensures the host GCC’s C++ headers are found by ‘xgcc’ during
> >> build.
> >
> > Why do you want that to happen?
> >
> > It's wrong in general, but it's specifically wrong in your case
> > because the host compiler is a different version to the one you're
> > trying to build. There is absolutely no guarantee that GCC 10.1 can
> > compile the libstdc++ headers from GCC 7.5, and trying to do so is not
> > supported.
>
> Is it wrong? I’m talking about the first time where
> ‘libstdc++-v3/configure’ runs, which itself checks for C++ features.
> It’s checking for C++ features of the host compiler/C++ library, isn’t it?
No. Building libstdc++ is done with the GCC that's just been built,
not with the host compiler.
You can see that for yourself, because te error you showed was running
/tmp/guix-build-gcc-10.1.0.drv-0/build/./gcc/xgcc and that's not the
host compiler, that's the one that's just been built.
I think the problem is that CPLUS_INCLUDE_PATH affects both the host
compiler, and the newly-built one. I don't see how you can use an
environment variable to set include paths to C++ headers that are
valid for both compilers at once. Because no set of libstdc++ headers
is valid for both GCC 7.5 and 10.1 at the same time.
next prev parent reply other threads:[~2020-07-28 14:21 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-22 20:38 Ludovic Courtès
2020-07-27 16:32 ` Jonathan Wakely
2020-07-28 14:15 ` Ludovic Courtès
2020-07-28 14:21 ` Jonathan Wakely [this message]
2020-07-28 14:25 ` Jonathan Wakely
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAH6eHdQ=FQZW7T-OUjEbSWrzEFBULa87ub72Y91K3chOdUOn_Q@mail.gmail.com' \
--to=jwakely.gcc@gmail.com \
--cc=gcc-help@gcc.gnu.org \
--cc=ludovic.courtes@inria.fr \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).