From: kmx <kmx@atlas.cz>
To: pgsql-bugs@postgresql.org
Subject: PostgreSQL fails to build with 32bit MinGW-w64
Date: Fri, 08 Jul 2011 01:51:16 +0200
Message-ID: <4E164674.7070103@atlas.cz> (raw)
Hi,
couple of weeks (maybe months) ago postgresql introduced support for mingw-w64 compiler on
MS Windows platform; however the related patch was based on assumption that
mingw-w64 project delivers just 64bit compiler (which is not true - they
deliver both 32/64bit compilers).
According to my testing - postgresql-9.0.4 does compile fine with 64bit
mingw-w64 but fails with 32-bit mingw-w64 compiler.
Try to have a look at the enclosed patch which makes it possible to compile
postgresql-9.0.4 with 32bit mingw-w64.
--
kmx
Attachments:postgresql-9.0.4.diff (text/plain, 2.5K) download
diff -r -u -w --strip-trailing-cr /z/strawberry_libs/build/_wrk_libs2011_/postgresql-9.0.4/src/include/c.h /z/strawberry_libs/build/../patches/postgresql-9.0.4/src/include/c.h
--- /z/strawberry_libs/build/_wrk_libs2011_/postgresql-9.0.4/src/include/c.h 2011-04-15 03:15:53 +0000+++ /z/strawberry_libs/build/../patches/postgresql-9.0.4/src/include/c.h 2011-05-06 11:39:13 +0000@@ -58,17 +58,21 @@
#endif
#include "postgres_ext.h"
-#if _MSC_VER >= 1400 || defined(WIN64)-#define errcode __msvc_errcode-#include <crtdefs.h>-#undef errcode-#endif-
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stddef.h>
#include <stdarg.h>
++/* note: __MINGW64_VERSION_MAJOR is related to both 32/bit gcc compiles by mingw-w64+ * however it gots defined only after #include <any standard mingw header>+ */+#if _MSC_VER >= 1400 || defined(WIN64) || defined(__MINGW64_VERSION_MAJOR)+#define errcode __msvc_errcode+#include <crtdefs.h>+#undef errcode+#endif+
#ifdef HAVE_STRINGS_H
#include <strings.h>
#endif
diff -r -u -w --strip-trailing-cr /z/strawberry_libs/build/_wrk_libs2011_/postgresql-9.0.4/src/include/port/win32.h /z/strawberry_libs/build/../patches/postgresql-9.0.4/src/include/port/win32.h
--- /z/strawberry_libs/build/_wrk_libs2011_/postgresql-9.0.4/src/include/port/win32.h 2011-04-15 03:15:53 +0000+++ /z/strawberry_libs/build/../patches/postgresql-9.0.4/src/include/port/win32.h 2011-05-06 11:46:54 +0000@@ -31,7 +31,7 @@
* The Mingw64 headers choke if this is already defined - they
* define it themselves.
*/
-#if !defined(WIN64) || defined(WIN32_ONLY_COMPILER)+#if (!defined(WIN64) || defined(WIN32_ONLY_COMPILER)) && !defined(__MINGW64_VERSION_MAJOR)
#define _WINSOCKAPI_
#endif
#include <winsock2.h>
diff -r -u -w --strip-trailing-cr /z/strawberry_libs/build/_wrk_libs2011_/postgresql-9.0.4/src/port/getaddrinfo.c /z/strawberry_libs/build/../patches/postgresql-9.0.4/src/port/getaddrinfo.c
--- /z/strawberry_libs/build/_wrk_libs2011_/postgresql-9.0.4/src/port/getaddrinfo.c 2011-04-15 03:15:53 +0000+++ /z/strawberry_libs/build/../patches/postgresql-9.0.4/src/port/getaddrinfo.c 2011-05-06 11:20:18 +0000@@ -329,7 +329,7 @@
return "Not enough memory";
#endif
#ifdef EAI_NODATA
-#if !defined(WIN64) && !defined(WIN32_ONLY_COMPILER) /* MSVC/WIN64 duplicate */+#if !defined(WIN64) && !defined(WIN32_ONLY_COMPILER) && !defined(__MINGW64_VERSION_MAJOR) /* MSVC/WIN64 duplicate */
case EAI_NODATA:
return "No host data of that type was found";
#endif
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-bugs@postgresql.org
Cc: kmx@atlas.cz
Subject: Re: PostgreSQL fails to build with 32bit MinGW-w64
In-Reply-To: <4E164674.7070103@atlas.cz>
References: <4E164674.7070103@atlas.cz>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox