pg.ddx.io pgsql-bugs@postgresql.org mailing list archive
help / color / mirror / Atom feedPostgreSQL fails to build with 32bit MinGW-w64
3+ messages / 3 participants
[nested] [flat]
* PostgreSQL fails to build with 32bit MinGW-w64
@ 2011-07-07 23:49 kmx <kmx@volny.cz>
0 siblings, 0 replies; 3+ messages in thread
From: kmx @ 2011-07-07 23:49 UTC (permalink / raw)
To: pgsql-bugs
Hi,
couple of weeks 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
^ permalink raw reply [nested|flat] 3+ messages in thread
* PostgreSQL fails to build with 32bit MinGW-w64
@ 2011-07-07 23:51 kmx <kmx@atlas.cz>
2011-07-20 19:06 ` Re: PostgreSQL fails to build with 32bit MinGW-w64 Robert Haas <robertmhaas@gmail.com>
0 siblings, 1 reply; 3+ messages in thread
From: kmx @ 2011-07-07 23:51 UTC (permalink / raw)
To: pgsql-bugs
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
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: PostgreSQL fails to build with 32bit MinGW-w64
2011-07-07 23:51 PostgreSQL fails to build with 32bit MinGW-w64 kmx <kmx@atlas.cz>
@ 2011-07-20 19:06 ` Robert Haas <robertmhaas@gmail.com>
0 siblings, 0 replies; 3+ messages in thread
From: Robert Haas @ 2011-07-20 19:06 UTC (permalink / raw)
To: kmx <kmx@atlas.cz>; +Cc: pgsql-bugs
On Thu, Jul 7, 2011 at 7:51 PM, kmx <kmx@atlas.cz> wrote:
> 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.
You might want to read this:
http://wiki.postgresql.org/wiki/Submitting_a_Patch
And add your patch here:
https://commitfest.postgresql.org/action/commitfest_view/open
--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2011-07-20 19:06 UTC | newest]
Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2011-07-07 23:49 PostgreSQL fails to build with 32bit MinGW-w64 kmx <kmx@volny.cz>
2011-07-07 23:51 PostgreSQL fails to build with 32bit MinGW-w64 kmx <kmx@atlas.cz>
2011-07-20 19:06 ` Robert Haas <robertmhaas@gmail.com>
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