As shown at https://github.com/Gnucash/gnucash/blob/267a7cb75d3b54cf359eb913c9f830b48307ae6a/libgnucash/backend/dbi/gnc-backend-dbi.cpp#L32-L36 the file does #undef __STRICT_ANSI__ unconditionally, but then only redefines it for Windows: https://github.com/Gnucash/gnucash/blob/267a7cb75d3b54cf359eb913c9f830b48307ae6a/libgnucash/backend/dbi/gnc-backend-dbi.cpp#L88-L93 This means it is left undefined for other platforms. This causes undefined behaviour (even undefining the macro in the first place is undefined behaviour, so you should check if that workaround is really still needed for MinGW or if it can simply be removed). In GCC 11 messing with that macro puts the C++ standard library into an inconsistent and broken state, and so there are checks in place to detect it. Due to the use of -Werror the warning about __STRICT_ANSI__ is an error, so gnucash 4.2 fails to compile in Fedora rawhide: In file included from /usr/include/c++/11/cstdlib:41, from /usr/include/c++/11/stdlib.h:36, from /usr/include/glib-2.0/glib/gutils.h:433, from /usr/include/glib-2.0/glib/gthread.h:34, from /usr/include/glib-2.0/glib/gasyncqueue.h:32, from /usr/include/glib-2.0/glib.h:32, from /builddir/build/BUILD/gnucash-4.2/libgnucash/backend/dbi/gnc-backend-dbi.cpp:51: /usr/include/c++/11/x86_64-redhat-linux/bits/c++config.h:2702:2: error: #warning "__STRICT_ANSI__ seems to have been undefined; this is not supported" [-Werror=cpp] 2702 | #warning "__STRICT_ANSI__ seems to have been undefined; this is not supported" | ^~~~~~~ See https://gcc.gnu.org/gcc-11/porting_to.html#strict-ansi for notes about the GCC 11 changes. The correct fix is documented there: instead of compiling in a strict mode and then trying to be unstrict, just stop using the wrong -std option in the first place.
Created attachment 373985 [details] Patch to make the #undef conditional Here's the workaround I'm using for Fedora. This doesn't fix the problem for anybody using GCC 11 on Windows, so you'll still need to do it properly by using -std=gnu++17 instead of -std=c++17 in CMakeLists.txt
Indeed, none of that is needed any more.