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: Andrew Dunstan <andrew(at)dunslane(dot)net>, NISHIYAMA Tomoaki <tomoakin(at)staff(dot)kanazawa-u(dot)ac(dot)jp>, Magnus Hagander <magnus(at)hagander(dot)net>
Subject: Re: [PATCH] PostgreSQL fails to build with 32bit MinGW-w64
Date: 2011-12-05 14:31:32
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-hackers

If we are not to use 64 bit file size (and time),
#undef stat may be sufficient. The #undef should be
before the prototype of pgwin32_safestat because the
#define stat _stat64 affect both the function and struct stat.
The #undef stat necessitate #undef fstat as the parameter
struct stat * is changed.

Additional change are for the macro redefinition warnings.
(Suppress warnings, but perhaps not very different)

The patch is tested to compile on 
x86_64-w64-mingw32-gcc 4.7.0 20111203 (experimental)
gcc version 4.6.1 on MingW/MSYS

--- a/src/include/port.h
+++ b/src/include/port.h
@@ -334,6 +334,12 @@ extern bool rmtree(const char *path, bool rmtopdir);
 #if defined(WIN32) && !defined(__CYGWIN__) && !defined(UNSAFE_STAT_OK)
 #include <sys/stat.h>
+#ifdef stat
+#undef stat
+#ifdef fstat
+#undef fstat
 extern int	pgwin32_safestat(const char *path, struct stat * buf);
 #define stat(a,b) pgwin32_safestat(a,b)

If this is not sufficient, we might need to change all call of stat, lstat, and fstat
to some wrapper functions?  : It's theoretically doable, but could be quite difficult
for a huge software.

Attachment: pgsql-mingw64-patch.diff
Description: application/octet-stream (7.2 KB)

In response to


pgsql-hackers by date

Next:From: Ross ReedstromDate: 2011-12-05 15:29:53
Subject: Re: Command Triggers
Previous:From: Merlin MoncureDate: 2011-12-05 14:01:52
Subject: Re: planner fails on HEAD

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