From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 3249B3858002; Thu, 6 Jan 2022 20:33:37 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3249B3858002 From: "redi at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug libstdc++/100017] [11/12 regression] error: 'fenv_t' has not been declared in '::' -- canadian compilation fails Date: Thu, 06 Jan 2022 20:33:36 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: libstdc++ X-Bugzilla-Version: 11.0 X-Bugzilla-Keywords: build X-Bugzilla-Severity: normal X-Bugzilla-Who: redi at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: redi at gcc dot gnu.org X-Bugzilla-Target-Milestone: 11.3 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Jan 2022 20:33:37 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D100017 --- Comment #68 from Jonathan Wakely --- (In reply to Jakub Jelinek from comment #57) > I don't see how the patch could be correct. > [...] > So, if CXX_FOR_TARGET starts with /, e.g. /opt/gcc-11.1/bin/g++ , then > the above will use dirname /opt/gcc-11.1/bin/g++ and set ac_dir to > /opt/gcc-11.1/bin > But with the proposed change, $RAW_CXX_FOR_TARGET will be > /opt/gcc-11.1/bin/g++ -nostdinc++ and dirname will fail miserably and not > set ac_dir to anything: > dirname /opt/gcc-11.1/bin/g++ -nostdinc++ > dirname: invalid option -- 'n' > Try 'dirname --help' for more information. Jakub's analysis is correct. If the cross compiler is found in PATH then the patch works OK. The configure output shows: checking where to find the target c++... pre-installed checking where to find the target c++ for libstdc++... pre-installed If you build with something like CXX_FOR_TARGET=3D/home/jwakely/gcc/aarch64/bin/aarch64-none-linux-gnu-g++ t= hen configure shows: checking where to find the target c++... pre-installed in /home/jwakely/gcc/aarch64/bin checking where to find the target c++ for libstdc++... pre-installed in /home/jwakely/gcc/aarch64/bin But with the patch that prints an error: checking where to find the target c++... pre-installed in /home/jwakely/gcc/aarch64/bin checking where to find the target c++ for libstdc++... dirname: invalid opt= ion -- 'n' Try 'dirname --help' for more information. pre-installed in=20 I don't think that actually causes a problem though. The build still works.= The dirname command is only used to print the result during configure. It's not great though. If we do this instead, then we don't have that problem: diff --git a/Makefile.in b/Makefile.in index 79c77fccf0f..ada25b8f11b 100644 --- a/Makefile.in +++ b/Makefile.in @@ -329,7 +329,7 @@ BASE_TARGET_EXPORTS =3D \ RAW_CXX_TARGET_EXPORTS =3D \ $(BASE_TARGET_EXPORTS) \ CXX_FOR_TARGET=3D"$(RAW_CXX_FOR_TARGET)"; export CXX_FOR_TARGET; \ - CXX=3D"$(RAW_CXX_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS"; ex= port CXX; + CXX=3D"$(RAW_CXX_FOR_TARGET) -nostdinc++ $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS"; export CXX; NORMAL_TARGET_EXPORTS =3D \ $(BASE_TARGET_EXPORTS) \ diff --git a/Makefile.tpl b/Makefile.tpl index ef58fac2b9a..fc10c7a771d 100644 --- a/Makefile.tpl +++ b/Makefile.tpl @@ -332,7 +332,7 @@ BASE_TARGET_EXPORTS =3D \ RAW_CXX_TARGET_EXPORTS =3D \ $(BASE_TARGET_EXPORTS) \ CXX_FOR_TARGET=3D"$(RAW_CXX_FOR_TARGET)"; export CXX_FOR_TARGET; \ - CXX=3D"$(RAW_CXX_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS"; ex= port CXX; + CXX=3D"$(RAW_CXX_FOR_TARGET) -nostdinc++ $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS"; export CXX; NORMAL_TARGET_EXPORTS =3D \ $(BASE_TARGET_EXPORTS) \ I think that will mean we get -nostdinc++ twice for build=3D=3Dhost builds,= but that's harmless. The other reason I'm unsure about adding -nostdinc++ to RAW_CXX_FOR_TARGET = is that it's also used for building other target libs, specifically libsanitiz= er and libvtv. I think it's correct for them too.=