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: | 2E7D840A-66C6-453E-AE3C-492FB9E2C82E@staff.kanazawa-u.ac.jp |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Hi,
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)
and
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
+#endif
+#ifdef fstat
+#undef fstat
+#endif
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 | Content-Type | Size |
---|---|---|
pgsql-mingw64-patch.diff | application/octet-stream | 7.2 KB |
unknown_filename | text/plain | 3.4 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Ross Reedstrom | 2011-12-05 15:29:53 | Re: Command Triggers |
Previous Message | Merlin Moncure | 2011-12-05 14:01:52 | Re: planner fails on HEAD |