Yoann Vandoorselaere <[EMAIL PROTECTED]> writes: > Le mercredi 17 janvier 2007 à 13:57 +0100, Simon Josefsson a écrit : >> Yoann Vandoorselaere <[EMAIL PROTECTED]> writes: >> >> > Hi, >> > >> > This occur when trying to compile the getaddrinfo() module under MinGW: >> > >> > checking for library containing getaddrinfo... no >> > checking for getaddrinfo... no >> > checking for getaddrinfo in ws2tcpip.h and -lws2_32... yes >> > checking for gai_strerror... no >> > [...] >> > checking whether gai_strerror is declared... yes >> > >> > >> > gcc -std=gnu99 -DHAVE_CONFIG_H -I. -I. -I.. -g -O2 -Wall >> > -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations >> > -Wbad-function-cast -Wcast-qual -Wcast-align -Wnested-externs -Wunused >> > -MT gai_strerror.lo -MD -MP -MF .deps/gai_strerror.Tpo -c gai_strerror.c >> > -DDLL_EXPORT -DPIC -o .libs/gai_strerror.o >> > gai_strerror.c:68: conflicting types for `gai_strerrorA' >> > c:/MinGW/include/ws2tcpip.h:301: previous declaration of `gai_strerrorA' >> >> I don't get the same, I get: >> >> http://autobuild.josefsson.org/gnulib-mingw32/log-200701171211588110000.txt >> >> (Disregard the first ./configure output, it uses native cc.) > > Different MinGW version? The user reporting the problem is using > MinGW-3.0.0.
Ouch... >> > The definition in ws2tcpip.h look like: >> > >> > char* WSAAPI gai_strerrorA(int); >> > WCHAR* WSAAPI gai_strerrorW(int); >> > #ifdef UNICODE >> > #define gai_strerror gai_strerrorW >> > #else >> > #define gai_strerror gai_strerrorA >> > #endif /* UNICODE */ >> > >> > >> > As a result, shouldn't we always declare gai_strerror() in case the >> > function is missing but the declaration is available? >> >> I'm not sure how to handle this. Declaring the function doesn't seem >> like a solution, since it will still collide with their definition (we >> use 'const' and they don't, and they add 'WSAAPI', but the last part >> may not matter). > > We could use a replacement function: > > #undef gai_strerror > #define gai_strerror rpl_gai_strerror > > Shouldn't we? Hm, yes, that might work. >> However, perhaps the error is that getaddrinfo/gai_strerror is built >> at all on your system. mingw32 appear to have working getaddrinfo, so >> we shouldn't need to build anything. > > getaddrinfo() seem to be working (and the module handle that part fine), > but there is no gai_strerror() symbol available, which is a requirement > in an environment using getaddrinfo(), thus we should compile the > replacement function. Ah, I remember, it happened for Windows 2000 if I remember correctly. I don't have time to work on a solution here, but if you come up with anything, we can commit it and let the build bot test it. :) /Simon