From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-io1-xd36.google.com (mail-io1-xd36.google.com [IPv6:2607:f8b0:4864:20::d36]) by sourceware.org (Postfix) with ESMTPS id 7792B3857030 for ; Mon, 27 Jul 2020 16:32:23 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 7792B3857030 Received: by mail-io1-xd36.google.com with SMTP id l17so17615687iok.7 for ; Mon, 27 Jul 2020 09:32:23 -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=/tirln4qvXCb3yD3V6CVfEwh392XZeig99tH8O5zAzo=; b=G5lvBcZLYP44YM0Nk6R7antp77vxBxatBvstXEhOGR0lgOw167bjCn0afHSphjn609 TIFXSTTDmiSgW3rLHi81Yx8AEBPjhASVN63aG5j4A5gIW1fadKgL//SnB2ixUy3+Rptg unYThq5rHYk0QoxctWNpZasxqnS5YHWd4NQKJi2MgO8WdCsz1kQdhew5cyr5NTzjhk6l xBskK8ov/vn7pA2QIz4N8BvER+PK1tRvkB5wwl0+wD4XzxgFjkgdVZbQXxJQokDm/Yn3 pojebsZqSUjvhdcwcEtlorp4TMc1H6FMXhtq2ld3zXxVIyzLxjpW8yjYyH+aBgzI6oQO S3qg== X-Gm-Message-State: AOAM530Z8nxmqSBcFONUqswnRm9w6OEY7ZiKyYqWwJwh8JU4r0ZmHmmx 2qUKWHzZgLscB9RLQbZp3Rqd8Qsmqx1Gi5tMSN+qcQ== X-Google-Smtp-Source: ABdhPJw5OXBYhNg+14ul1rI2UoYxxk/8bgpeb7JtESNa7z/zFpbpqbQeo/X0XEnNnRUqTdwpEEuqW8XN+OnaV30HTwc= X-Received: by 2002:a05:6638:13c7:: with SMTP id i7mr11661074jaj.52.1595867541595; Mon, 27 Jul 2020 09:32:21 -0700 (PDT) MIME-Version: 1.0 References: <87lfjbgua3.fsf@inria.fr> In-Reply-To: <87lfjbgua3.fsf@inria.fr> From: Jonathan Wakely Date: Mon, 27 Jul 2020 17:32:10 +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, KAM_SHORT, 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: Mon, 27 Jul 2020 16:32:24 -0000 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/host= /gcc/include That looks wrong. Why are you doing this? Doesn't your host GCC already know where its headers are? If you need to override the paths, you need to include *all* the relevant directories. > ./configure && make Don't build in the source dir. See https://gcc.gnu.org/wiki/InstallingGCC > > where /path/to/host/gcc points to the GCC used to build GCC. > > This ensures the host GCC=E2=80=99s C++ headers are found by =E2=80=98xgc= c=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. > However, during libstdc++ configure, the host GCC=E2=80=99s > is not found, Because you only told it to look in two directories, neither of which contains that file. > leading to misdiagnostics like this > (here we=E2=80=99re building GCC 10.1 with GCC 7.5): > > --8<---------------cut here---------------start------------->8--- > configure:19924: checking for float trig functions > configure:19948: /tmp/guix-build-gcc-10.1.0.drv-0/build/./gcc/xgcc -shar= ed-libgcc -B/tmp/guix-build-gcc-10.1.0.drv-0/build/./gcc -nostdinc++ -L/tmp= /guix-build-gcc-10.1.0.drv-0/build/x86_64-unknown-linux-gnu/libstdc++-v3/sr= c -L/tmp/guix-build-gcc-10.1.0.drv-0/build/x86_64-unknown-linux-gnu/libstdc= ++-v3/src/.libs -L/tmp/guix-build-gcc-10.1.0.drv-0/build/x86_64-unknown-lin= ux-gnu/libstdc++-v3/libsupc++/.libs -B/gnu/store/jrzxs91zhpf6yr5fxisn3jjj7x= ai8zlk-gcc-10.1.0/x86_64-unknown-linux-gnu/bin/ -B/gnu/store/jrzxs91zhpf6yr= 5fxisn3jjj7xai8zlk-gcc-10.1.0/x86_64-unknown-linux-gnu/lib/ -isystem /gnu/s= tore/jrzxs91zhpf6yr5fxisn3jjj7xai8zlk-gcc-10.1.0/x86_64-unknown-linux-gnu/i= nclude -isystem /gnu/store/jrzxs91zhpf6yr5fxisn3jjj7xai8zlk-gcc-10.1.0/x86_= 64-unknown-linux-gnu/sys-include -fno-checking -c -fno-builtin -D_GNU_SOU= RCE conftest.cpp >&5 > In file included from /gnu/store/rn75fm7adgx3pw5j8pg3bczfqq1y17lk-gcc-7.5= .0/include/c++/math.h:36, > from conftest.cpp:122: > /gnu/store/rn75fm7adgx3pw5j8pg3bczfqq1y17lk-gcc-7.5.0/include/c++/cmath:4= 1:10: fatal error: bits/c++config.h: No such file or directory > 41 | #include > | ^~~~~~~~~~~~~~~~~~ > compilation terminated. > configure:19948: $? =3D 1 > configure: failed program was: > > [...] > > | /* end confdefs.h. */ > | #include > | int > | main () > | { > | acosf (0); asinf (0); atanf (0); cosf (0); sinf (0); tanf (0); coshf (0= ); sinhf (0); tanhf (0); > | ; > | return 0; > | } > configure:19962: result: no > --8<---------------cut here---------------end--------------->8--- > > =E2=80=98c++config.h=E2=80=99 is not found because it lives in a differen= t directory > that=E2=80=99s not searched, =E2=80=98include/c++/x86_64-unknown-linux-gn= u=E2=80=99. > (aka. =E2=80=98GPLUSPLUS_TOOL_INCLUDE_DIR=E2=80=99). > > So, how=E2=80=99s that supposed to work? I understand this kind of issue= is > unlikely to show up on an FHS distro, but still, am I missing something? You should not be using CPLUS_INCLUDE_PATH like that. > > Thanks, > Ludo=E2=80=99. > > =C2=B9 More details at .