Re: Removing dependency to wsock32.lib when compiling code on WIndows

From: Noah Misch <noah(at)leadboat(dot)com>
To: Jeff Janes <jeff(dot)janes(at)gmail(dot)com>
Cc: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>, Magnus Hagander <magnus(at)hagander(dot)net>, MauMau <maumau307(at)gmail(dot)com>, PostgreSQL mailing lists <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Removing dependency to wsock32.lib when compiling code on WIndows
Date: 2014-08-12 00:43:44
Message-ID: 20140812004344.GB259708@tornado.leadboat.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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'll use our
* own
*/
#undef gai_strerror

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

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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2014-08-12 01:06:05 Re: Improvement of versioning on Windows, take two
Previous Message Tomas Vondra 2014-08-12 00:22:59 Re: failures on barnacle (CLOBBER_CACHE_RECURSIVELY) because of memory leaks