Once configure step succeeded, I ran "make". I found several
Gnulib-related problems:
gcc -DHAVE_CONFIG_H -I. -I../.. -Id:/usr/include -Wno-cast-qual
-Wno-conversion -Wno-float-equal -Wno-sign-compare -Wno-undef
-Wno-unused-function -Wno-unused-parameter -Wno-float-conversion
-Wimplicit-fallthrough -Wno-pedantic -Wno-sign-conversion -Wno-type-limits
-Wno-unused-const-variable -Wno-unsuffixed-float-constants -Wno-error -O2
-gdwarf-4 -g3 -MT libgnu_a-btowc.o -MD -MP -MF .deps/libgnu_a-btowc.Tpo -c -o
libgnu_a-btowc.o `test -f 'btowc.c' || echo './'`btowc.c
In file included from ./wctype.h:56,
from d:\usr\include\wchar.h:62,
from ./wchar.h:77,
from btowc.c:21:
./wchar.h:923:1: error: unknown type name 'mbstate_t'
923 | _GL_FUNCDECL_RPL (mbsinit, int, (const mbstate_t *ps), );
| ^~~~~~~~~~~~~~~~
In file included from ./wctype.h:56,
from d:\usr\include\wchar.h:62,
from ./wchar.h:77,
from btowc.c:21:
./wchar.h:1135:10: error: unknown type name 'mbstate_t'
1135 | mbszero (mbstate_t *ps)
| ^~~~~~~~~
In file included from ./wctype.h:56,
from d:\usr\include\wchar.h:62,
from ./wchar.h:77,
from btowc.c:21:
d:\usr\lib\gcc\mingw32\9.2.0\include\stddef.h:350:23: error: conflicting
types for '
rpl_wint_t'
350 | typedef __WINT_TYPE__ wint_t;
| ^~~~~~
./wchar.h:740:22: note: previous declaration of 'rpl_wint_t' was here
740 | typedef unsigned int rpl_wint_t;
| ^~~~~~~~~~
In file included from ./wctype.h:56,
from d:\usr\include\wchar.h:62,
from ./wchar.h:77,
from btowc.c:21:
d:\usr\include\wchar.h:539:33: error: conflicting types for 'rpl_btowc'
539 | __cdecl __MINGW_NOTHROW wint_t btowc (int);
| ^~~~~
In file included from ./wctype.h:56,
from d:\usr\include\wchar.h:62,
from ./wchar.h:77,
from btowc.c:21:
./wchar.h:869:1: note: previous declaration of 'rpl_btowc' was here
869 | _GL_FUNCDECL_RPL (btowc, wint_t, (int c), _GL_ATTRIBUTE_PURE);
| ^~~~~~~~~~~~~~~~
In file included from ./wctype.h:56,
from d:\usr\include\wchar.h:62,
from ./wchar.h:77,
from btowc.c:21:
btowc.c:28:1: error: conflicting types for 'rpl_btowc'
28 | btowc (int c)
| ^~~~~
In file included from ./wctype.h:56,
from d:\usr\include\wchar.h:62,
from ./wchar.h:77,
from btowc.c:21:
./wchar.h:869:1: note: previous declaration of 'rpl_btowc' was here
869 | _GL_FUNCDECL_RPL (btowc, wint_t, (int c), _GL_ATTRIBUTE_PURE);
| ^~~~~~~~~~~~~~~~
btowc.c: In function 'rpl_btowc':
btowc.c:38:7: warning: implicit declaration of function 'mbszero'
[-Wimplicit-function-declaration]
38 | mbszero (&state);
| ^~~~~~~
Makefile:2934: recipe for target `libgnu_a-btowc.o' failed
make[4]: *** [libgnu_a-btowc.o] Error 1
This is because the MinGW wchar.h includes wctype.h, so we include the
Gnulib's version of it, and that one then turns around and includes
wchar.h again. But because the MinGW wchar.h was not yet completely
processed, mbstate_t is not yet defined.
I don't know how to solve this cleanly. I hope Bruno will know. The
kludge I used was not to include wchar.h from wctype.h. The original
Gnulib's wctype.h includes wchar.h twice:
#if 1
/* Solaris 2.5 has a bug: <wchar.h> must be included before <wctype.h>. */
# include <wchar.h>
#endif
/* Native Windows (mingw, MSVC) have declarations of towupper, towlower, and
isw* functions in <ctype.h>, <wchar.h> as well as in <wctype.h>. Include
<ctype.h>, <wchar.h> in advance to avoid rpl_ prefix being added to the
declarations. */
#if defined _WIN32 && ! defined __CYGWIN__
# include <ctype.h>
# include <wchar.h>
#endif
I needed to remove both these lines.
Another Gnulib-related problem was with stdio-consolesafe.c:
gcc -DHAVE_CONFIG_H -I. -I../.. -Id:/usr/include -Wno-cast-qual
-Wno-conversion -Wno-float-equal -Wno-sign-compare -Wno-undef
-Wno-unused-function -Wno-unused-parameter -Wno-float-conversion
-Wimplicit-fallthrough -Wno-pedantic -Wno-sign-conversion -Wno-type-limits
-Wno-unused-const-variable -Wno-unsuffixed-float-constants -Wno-error -O2
-gdwarf-4 -g3 -MT libgnu_a-stdio-consolesafe.o -MD -MP -MF
.deps/libgnu_a-stdio-consolesafe.Tpo -c -o libgnu_a-stdio-consolesafe.o `test
-f 'stdio-consolesafe.c' || echo './'`stdio-consolesafe.c
stdio-consolesafe.c:88:1: error: static declaration of 'vasprintf' follows
non-static declaration
88 | vasprintf (char **resultp, const char *format, va_list args)
| ^~~~~~~~~
In file included from stdio-consolesafe.c:20:
./stdio.h:2346:1: note: previous declaration of 'vasprintf' was here
2346 | _GL_FUNCDECL_SYS (vasprintf, int,
| ^~~~~~~~~~~~~~~~
I originally just removed the 'static' qualifier from the version of
vasprintf included in stdio-consolesafe.c, but that failed the link
step further down the line, because Gnulib also includes vasprintf.c,
which the MinGW build compiles and links against. So, again as a
temporary kludge, I renamed the vasprintf in stdio-consolesafe.c to
rpl_vasprintf, and that solved the compilation and link problems.
Again, I hope Bruno will be able to suggest a clean solution.
Thanks.