Re: Removing dependency to wsock32.lib when compiling code on WIndows - Mailing list pgsql-hackers

From Noah Misch
Subject Re: Removing dependency to wsock32.lib when compiling code on WIndows
Date
Msg-id 20140812004344.GB259708@tornado.leadboat.com
Whole thread Raw
In response to Re: Removing dependency to wsock32.lib when compiling code on WIndows  (Jeff Janes <jeff.janes@gmail.com>)
Responses Re: Removing dependency to wsock32.lib when compiling code on WIndows
List pgsql-hackers
On Mon, Aug 11, 2014 at 11:02:48AM -0700, Jeff Janes wrote:
> While trying to test more recent stuff against mingw, I kept running into a
> problem which bisected down to this (a16bac36eca8158cbf78987e953).

> This is the warning/error I get:
> 
> auth.c: In function 'ClientAuthentication':
> auth.c:458:6: warning: implicit declaration of function 'gai_strerror'
> [-Wimplicit-function-declaration]

> libpq/auth.o:auth.c:(.text+0x1949): undefined reference to `gai_strerror'
> libpq/auth.o:auth.c:(.text+0x19c4): undefined reference to `gai_strerror'
> libpq/auth.o:auth.c:(.text+0x1b1a): undefined reference to `gai_strerror'
> libpq/auth.o:auth.c:(.text+0x1cb4): undefined reference to `gai_strerror'
> libpq/auth.o:auth.c:(.text+0x1cdc): undefined reference to `gai_strerror'

> Any suggestions on what to try?  This patch doesn't seem to explicitly
> mention gai_strerror at all, so it must be some indirect effect.

I, too, encountered that.  The patch let "configure" detect HAVE_GETADDRINFO
under MinGW-w64; passing "ac_cv_func_getaddrinfo=no" on the configure command
line is a workaround.  Under !HAVE_GETADDRINFO, "configure" arranges to build
src/port/getaddrinfo.c, and src/include/getaddrinfo.h injects the replacement
gai_strerror() prototype.  That understandably doesn't happen in a
HAVE_GETADDRINFO build, yet src/include/port/win32/sys/socket.h does the
following unconditionally:

/** we can't use the windows gai_strerror{AW} functions because* they are defined inline in the MS header files. So
we'lluse our* own*/
 
#undef gai_strerror

Somehow or other, we must bring these parts into agreement.

-- 
Noah Misch
EnterpriseDB                                 http://www.enterprisedb.com



pgsql-hackers by date:

Previous
From: Tomas Vondra
Date:
Subject: Re: failures on barnacle (CLOBBER_CACHE_RECURSIVELY) because of memory leaks
Next
From: Michael Paquier
Date:
Subject: Re: Improvement of versioning on Windows, take two