On 08/17/2011 10:15 AM, Marc-André Lureau wrote:
Hi

I am trying to compile libvirt which uses gnulib on f16 mingw32:

make[4]: Entering directory `/usr/src/libvirt/gnulib/lib'
   CC     pipe2.lo
In file included from ./sys/stat.h:375:0,
                  from ./fcntl.h:56,
                  from pipe2.c:26:
/usr/i686-w64-mingw32/sys-root/mingw/include/direct.h:57:17: error:
conflicting types for 'rpl_getcwd'
./unistd.h:853:1: note: previous declaration of 'rpl_getcwd' was here
make[4]: *** [pipe2.lo] Error 1

Apparently, getcwd get replaced by gnulib, perhaps because:

configure:11532: checking whether getcwd (NULL, 0) allocates memory for result
configure:11597: result: guessing no

but there is already a declaration of getcwd in mingw direct.h:

   char *__cdecl getcwd(char *_DstBuf,int _SizeInBytes)
__MINGW_ATTRIB_DEPRECATED_MSVC2005;

Thanks for the report. The bug here is that gnulib's <unistd.h> header is missing a #include <direct.h> when compiling on mingw, to get the conflicting system declaration out of the way before doing the override.


If I put #include<unistd.h>  after #include<fcntl.h>, compilation goes on

Our goal is to make the gnulib headers usable in any order. So this workaround confirms that the problem is in gnulib's replacement headers, but changing pipe2.c is not the correct solution.

I'll see if I can reproduce the issue, and so, post a gnulib patch shortly.

--
Eric Blake   [email protected]    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

Reply via email to