From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 298133899023; Mon, 10 Jan 2022 12:18:28 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 298133899023 From: "cvs-commit 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: Mon, 10 Jan 2022 12:18:27 +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: cvs-commit 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: Mon, 10 Jan 2022 12:18:28 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D100017 --- Comment #77 from CVS Commits --- The master branch has been updated by Jonathan Wakely : https://gcc.gnu.org/g:4fde88e5dd152fe866a97b12e0f8229970d15cb3 commit r12-6406-g4fde88e5dd152fe866a97b12e0f8229970d15cb3 Author: Jonathan Wakely Date: Fri Jan 7 15:21:03 2022 +0000 libstdc++: Add -nostdinc++ for c++17 sources [PR100017] When building a build!=3Dhost compiler, the just-built gcc can't be used to build the target libstdc++ (because it is built for the host triplet, not the build triplet). The top-level configure.ac sets up the build flags for libstdc++ (and other "raw_cxx" libs) like this: GCC_TARGET_TOOL(c++ for libstdc++, RAW_CXX_FOR_TARGET, CXX, [gcc/xgcc -shared-libgcc -B$$r/$(HOST_SUBDIR)/gcc -nostdinc++ -L$$r/$(TARGET_SUBDIR)/libstdc++-v3/src -L$$r/$(TARGET_SUBDIR)/libstdc++-v3/src/.libs -L$$r/$(TARGET_SUBDIR)/libstdc++-v3/libsupc++/.libs], c++) The -nostdinc++ flag is only used for the IN-TREE-TOOL, i.e. when using the just-built gcc/xgcc compiler. This means that the cross-compiler used to build libstdc++ will add its own libstdc++ headers to the include path. That results in the #include in src/c++17/floating_to_chars.cc and src/c++17/floating_from_chars.cc doing #include_next and finding the libstdc++ fenv.h wrapper from the host compiler. Because that has the same include guard as the in the libstdc++ we're trying to build, we never reach the underlying from libc. That results in several errors of the form: error: 'fenv_t' has not been declared in '::' The most correct fix would be to add -nostdinc++ to the RAW_CXX_FOR_TARGET variable in configure.ac, or the RAW_CXX_TARGET_EXPORTS variable in Makefile.tpl. Another solution would be to make the libstdc++ wrapper use _GLIBCXX_INCLUDE_NEXT_C_HEADERS like our and other C header wrappers. For now though, the simplest and safest solution is to just add -nostdinc++ to the CXXFLAGS used for src/c++17/*.cc, which is what this does. libstdc++-v3/ChangeLog: PR libstdc++/100017 * src/c++17/Makefile.am (AM_CXXFLAGS): Add -nostdinc++. * src/c++17/Makefile.in: Regenerate.=