[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: gethostname fix for mingw

From: Simon Josefsson
Subject: Re: gethostname fix for mingw
Date: Thu, 23 Oct 2008 08:31:29 +0200
User-agent: Gnus/5.110011 (No Gnus v0.11) Emacs/22.2 (gnu/linux)

Ben Pfaff <address@hidden> writes:

> Michel reported on pspp-dev that PSPP fails to compile on mingw
> due to the following error:
>> In file included from
>> C:/MinGW/bin/../lib/gcc/mingw32/3.4.5/../../../../include/windows.h:98,
>>                  from lseek.c:26:
>> C:/MinGW/bin/../lib/gcc/mingw32/3.4.5/../../../../include/winsock2.h:635:
>> error: conflicting types for 'gethostname'
>> ./unistd.h:313: error: previous declaration of 'gethostname' was here

I've seen this as well recently.

> I can see what is going wrong:
>         - The gethostname module fails to find gethostname()
>           because it is in the ws2_32 library, which it doesn't
>           try to link against.  Thus, it tries to replace it.
>         - Thus, it adds a prototype for gethostname() to the
>           replacement unistd.h.  This prototype has a length
>           parameter of type size_t (per POSIX).
>         - The lseek module needs unistd.h and windows.h.  The
>           latter in turn includes winsock2.h, which contains the
>           Windows prototype for gethostname(), which has an
>           length parameter of type int (who knows why).
> I think that the following change will fix the problem.  Does it
> look like the right approach?  If so, I will generate a new
> snapshot for Michel to test before I commit it to gnulib.

If it works, I'm for it.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]