On 2025-03-28 Pali Rohár wrote: > On Thursday 27 March 2025 22:17:54 Martin Storsjö wrote: > > Lasse pointed out that this seems to be due to __CRT__NO_INLINE - > > when building without optimizations, that is defined, and we get > > these errors. If building with optimizations enabled, it builds > > fine. > > > > Needless to say, our headers need to work both with and without > > optimizations... > > I was looking at this problem and investigating how to handle it. > Could you try if the following change fixes your build issue with > clang and libc++?
It should fix it for normal applications. When mingw-w64 is built, at least ftw.c calls stat(). Now that there will be four stat() variants, there needs to be four ftw() variants too. My patch 0009.txt in [1] does that. It needs the __MINGW_ASM_CALL redirects to pick the matching stat struct and function from <sys/stat.h>. Possible solutions: (1) Change ftw.c in my patch to do #undef _CRTBLD #include <sys/stat.h> #define _CRTBLD but that's ugly and possibly fragile. (2) In <sys/stat.h>, instead of #ifndef _CRTBLD, it could be: #if defined(_CRTBLD) && !defined(__MINGW_CRTBLD_STAT_VISIBLE) Then ftw.c could #define __MINGW_CRTBLD_STAT_VISIBLE. Maybe someone can suggest a nicer macro name. (3) My patch uses __CRT_BUILDING_FTW in <ftw.h> because there's a need to suppress the function redirects in <ftw.h> when building ftw.c. <sys/stat.h> could similarly have __CRT_BUILDING_STAT which the relevant .c files would define. But probably (2) is simpler. My ftw patch could use (2) too. [1] https://sourceforge.net/p/mingw-w64/mailman/message/59163785/ Message-ID: <20250322153548.402f660f.lasse.col...@tukaani.org> -- Lasse Collin _______________________________________________ Mingw-w64-public mailing list Mingw-w64-public@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mingw-w64-public