From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-io1-xd33.google.com (mail-io1-xd33.google.com [IPv6:2607:f8b0:4864:20::d33]) by sourceware.org (Postfix) with ESMTPS id D75A63842430 for ; Tue, 28 Jul 2020 14:21:48 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org D75A63842430 Received: by mail-io1-xd33.google.com with SMTP id a5so5668885ioa.13 for ; Tue, 28 Jul 2020 07:21:48 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=iChx+BgpzROKae2BJdaeSkcLjJIMKMrM60cYEYYpA5M=; b=gYn/OHlj6076vlmQT/Tj/XQ0gkc1YGR9r6FhfBPpw7JWfl05kHyYybjpyt3qM5Pgd7 YpuRRr+mwcgW+6+3U3PnzNPsic3U+EXKY/QQzM25hp90D7/ivbCjiGmF3zE1QbZ46sYx 7RXLTRo5ghAvdnCDbB2KrpRoiSVkTcS/Xd07XmdZzWGFZ1aRssg+foXj4sFxZKDg65e2 LQ29DfMc0AmeBjcZa4eqE0oE3G//HfB5hMUrFXmK/tdiH1N4/HDgxCpzgT/AYqHxSrNt liaBzFqWHRfAvR3kWqsyE+SN8wspn/9Dqw0E/bWJfQpEdBNP72X35dCwbSuYfZLHr4TE DjGQ== X-Gm-Message-State: AOAM532dI38NRdlqthRSkqT1bn/U76uqx5EiTWx+RL+Goh8DBlZFyGIr lRhrCe0ODdC3EdeN6Ji6l/CcAjmgUrO+YXegcPg= X-Google-Smtp-Source: ABdhPJzb+pYrSFYD1Zr0DW48G2sp88D/63KFIb9lj6XdfRx5RJozNUmXtF/QeIH2T9igOT64ok2YEnDTlRNNWf1E4TU= X-Received: by 2002:a6b:b655:: with SMTP id g82mr1602909iof.36.1595946108275; Tue, 28 Jul 2020 07:21:48 -0700 (PDT) MIME-Version: 1.0 References: <87lfjbgua3.fsf@inria.fr> <87eeovu3n7.fsf@inria.fr> In-Reply-To: <87eeovu3n7.fsf@inria.fr> From: Jonathan Wakely Date: Tue, 28 Jul 2020 15:21:37 +0100 Message-ID: Subject: Re: libstdc++ search path while building GCC To: =?UTF-8?Q?Ludovic_Court=C3=A8s?= Cc: gcc-help Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gcc-help@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-help mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Jul 2020 14:21:50 -0000 On Tue, 28 Jul 2020 at 15:15, Ludovic Court=C3=A8s wrote: > > Hi, > > Jonathan Wakely skribis: > > > On Wed, 22 Jul 2020 at 21:39, Ludovic Court=C3=A8s wrote: > >> > >> Hello, > >> > >> While building GCC on a non-FHS distro, we do something like=C2=B9: > >> > >> export CPLUS_INCLUDE_PATH=3D/path/to/host/gcc/include/c++:/path/to/h= ost/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=E2=80=99s own libstdc++. We could override that, but I=E2= =80=99m trying to > understand what=E2=80=99s going on. > > >> This ensures the host GCC=E2=80=99s C++ headers are found by =E2=80=98= xgcc=E2=80=99 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=E2=80=99m talking about the first time where > =E2=80=98libstdc++-v3/configure=E2=80=99 runs, which itself checks for C+= + features. > It=E2=80=99s checking for C++ features of the host compiler/C++ library, = isn=E2=80=99t 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.