Skip site navigation (1) Skip section navigation (2)

Re: [PATCH] PostgreSQL fails to build with 32bit MinGW-w64

From: NISHIYAMA Tomoaki <tomoakin(at)staff(dot)kanazawa-u(dot)ac(dot)jp>
To: pgsql-hackers(at)postgresql(dot)org
Cc: NISHIYAMA Tomoaki <tomoakin(at)staff(dot)kanazawa-u(dot)ac(dot)jp>, Lars Kanis <kanis(at)comcard(dot)de>
Subject: Re: [PATCH] PostgreSQL fails to build with 32bit MinGW-w64
Date: 2011-11-24 08:48:04
Message-ID: D0CE5EAA-7B84-44DA-9F8E-F0AFD26B2DD5@staff.kanazawa-u.ac.jp (view raw or flat)
Thread:
Lists: pgsql-hackers
Hi,

Isn't it better to check the value of macros itsef rather than checking for
system dependent macros that does not directly relate to the issue?
specifically for getaddrinfo.c case I think
#if EAI_NODATA != EAI_NONAME
is a better check than checking for
#if !defined(__MINGW64_VERSION_MAJOR) && !defined(WIN32_ONLY_COMPILER)	/* MSVC/WIN64 duplicate */

For the win32.h, I really don't understand why _WINSOCKAPI_ was defined before
<winsock2.h>
some google suggests that defining _WINSOCKAPI_ before <windows.h> prevents
inclusion of winsock.h but that does not have relation to inclusion of
<winsock2.h> and if <winsock2.h> is included first, it should be ok.

If this guess is right, perhaps it could be better to remove the three lines.
#if !defined(WIN64) || defined(WIN32_ONLY_COMPILER)
#define _WINSOCKAPI_
#endif

+/* __MINGW64_VERSION_MAJOR is related to both 32/64 bit gcc compiles by
+ * mingw-w64, however it gots defined only after
Why not use __MINGW32__, which is defined without including any headers?


On 2011/11/24, at 17:24, Lars Kanis wrote:

> Hi PostgreSQL hackers,
>  
> support for Mingw-w64 compiler was added to postgres with commit 91812df. Unfortunately only the 64 bit output is working right now. This issue was already highlighted with initial patch in
> http://archives.postgresql.org/pgsql-bugs/2011-07/msg00059.php
>  
> Mingw-w64 uses the same header files for 32 and 64 bit compiles. So the same conditions apply to mingw-w32 bit as for the WIN64 case. In WIN64 "WSAAPI" is defined to nothing, but in 32 bit to stdcall, so it needs to be used in the accept-parameter check, too. Maybe you prefer PASCAL instead of WSAAPI in configure.
>  
> I tested successful compilation for the following platforms:
> - i686-w64-mingw32 - gcc v4.6.1
> - x86_64-w64-mingw32 - gcc v4.6.1
> - i586-mingw32msvc - gcc v4.4.4
> - x86_64-linux-gnu - gcc v4.6.1
>  
> -- 
> Kind regards,
> Lars Kanis
>  
> <fix-mingw-w64-32bit_v1.patch>
> -- 
> Sent via pgsql-hackers mailing list (pgsql-hackers(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-hackers


In response to

Responses

pgsql-hackers by date

Next:From: Pavel GolubDate: 2011-11-24 08:55:01
Subject: Re: [PATCH] PostgreSQL fails to build with 32bit MinGW-w64
Previous:From: Lars KanisDate: 2011-11-24 08:24:22
Subject: [PATCH] PostgreSQL fails to build with 32bit MinGW-w64

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group