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
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
--
Sent via pgsql-bugs mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs