Here is an interesting problem.  This command

j...@mocca:~/src/gnulib master$ rm -rf m && gnulib-tool --create-testdir --dir 
m  getsubopt  gethostname && cd m && ./configure --host=i586-mingw32msvc 
--build=i686-pc-linux-gnu && make check

results in this error:

i586-mingw32msvc-gcc -DHAVE_CONFIG_H -I. -I..     -g -O2 -MT sockets.o -MD -MP 
-MF .deps/sockets.Tpo -c -o sockets.o sockets.c
In file included from ./sys/socket.h:123,
                 from sockets.h:37,
                 from sockets.c:23:
/usr/lib/gcc/i586-mingw32msvc/4.2.1-sjlj/../../../../i586-mingw32msvc/include/winsock2.h:635:
 error: conflicting types for ‘rpl_gethostname’
./unistd.h:524: error: previous declaration of ‘rpl_gethostname’ was here
make[3]: *** [sockets.o] Error 1

Superficially this is because winsock2.h defines:

int PASCAL gethostname(char*,int);

and gnulib's unistd contains:

extern int gethostname(char *name, size_t len) _GL_ARG_NONNULL ((1));

and the problem seems to be why the usual system prototype fixing
doesn't work.

The cause for this was introduced fairly recently, but I'm running out
of time to track down this today -- just preparing this standalone way
to reproduce the problem took quite some time, it surprised me that
getsubopt and gethostname would interact with each other.  It seems
gnulib's stdlib.h, unistd.h and sys/socket.h include each other in
interesting ways.

/Simon


Reply via email to