bug-cvs
[Top][All Lists]
Advanced

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

Re: windows build needs gethostname ?


From: Mark D. Baushke
Subject: Re: windows build needs gethostname ?
Date: Mon, 22 Nov 2004 10:10:22 -0800

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Greetings,

Using GNULIB xgethostname() is proving to be troublesome without the
following change.

Note: It may be desirable for gethostname.m4 to consider a search for
the function in the winsock.h file or to provide the prototype for
gethostname in some .h file somewhere.

ChangeLog Entry:

        * xgethostname.c: Provide prototype for gethostname when it is
          otherwise not available.

 Index: xgethostname.c
 ===================================================================
 RCS file: /cvsroot/gnulib/gnulib/lib/xgethostname.c,v
 retrieving revision 1.19
 diff -u -p -u -p -r1.19 xgethostname.c
 --- xgethostname.c     9 Aug 2004 23:45:32 -0000       1.19
 +++ xgethostname.c     22 Nov 2004 18:09:24 -0000
 @@ -35,6 +35,12 @@
  
  #include "xalloc.h"
  
 +#ifdef HAVE_WINSOCK_H
 +#include <winsock.h>
 +#elif !HAVE_GETHOSTNAME
 +int gethostname (char *, int);
 +#endif
 +
  #ifndef ENAMETOOLONG
  # define ENAMETOOLONG 0
  #endif


Conrad T. Pino <address@hidden> writes:

> From: "Conrad T. Pino" <address@hidden>
> To: "Bug CVS" <address@hidden>
> Date: Mon, 22 Nov 2004 09:22:02 -0800
> X-Mailer: Microsoft Outlook IMO, Build 9.0.6604 (9.0.2911.0)
> Subject: CVS Feature Branch - Windows Build Broken - lib/xgethostname.c &
>       WinSock
> Sender: address@hidden
> 
> File "lib/xgethostname.c" calls function "gethostname" which appears
> not to have a prototype.
> 
> If "#include <winsock.h>" is added to "lib/xgethostname.c" then the
> issue goes away.
> 
> What is the correct fix?
> 
> --------------------Configuration: libcvs - Win32 Debug--------------------
> Compiling...
> xgethostname.c
> H:\Conrad\Projects\cvs-1.12\lib\xgethostname.c(67) : warning C4013: 
> 'gethostname' undefined; assuming extern returning int
> Creating library...
> --------------------Configuration: libdiff - Win32 Debug--------------------
> Creating library...
> --------------------Configuration: cvsnt - Win32 Debug--------------------
> Linking...
> libdiff.lib(xgethostname.obj) : error LNK2001: unresolved external symbol 
> _gethostname
> .\WinDebug\cvs.exe : fatal error LNK1120: 1 unresolved externals
> Error executing link.exe.
> 
> cvs.exe - 2 error(s), 94 warning(s)
> 
...
> > From: Mark D. Baushke
> > 
... consideration of adding GNULIB gethostname.c to the windows build ...

> 
> Doesn't look promising to me since Windows doesn't have "uname"
> function and "HAVE_UNAME" macro is undefined.
> 
> Adding file resolves link errors but the operative code resulting
> from conditional compile is
> 
>   strcpy (name, "");          /* Hardcode your system name if you want.  */
> 
> which doesn't look very useful to me.
> 
> > I thought there was a gethostname() function for Windows, but
> > apparently the nightly test failed for lack of the funciton...
> 
> Not lack of the function, lack of "#include" with the protoype.

It seems to be time to ask GNULIB to make a change to xgethostname() if
posible.

        -- Mark
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (FreeBSD)

iD8DBQFBoiuO3x41pRYZE/gRAsz9AJ9siQHbW8HSsNvS/iM9+6orh8/C0QCgtTrl
naEZm2pSgbROb4Rm3izzD78=
=MKd5
-----END PGP SIGNATURE-----




reply via email to

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