Re: Compilation failure: 8.2.4 and 8.1.0 under XPPro/MinGW

Lists: pgsql-ports
From: "Phil Mills" <PMills(at)veeco(dot)com>
To: <pgsql-ports(at)postgresql(dot)org>
Subject: Compilation failure: 8.2.4 and 8.1.0 under XPPro/MinGW
Date: 2007-07-03 21:29:59
Message-ID: 5C45D12040C19D439DA0CE63A18738063399FF@ftcexch2.int.veeco.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-ports

I've seen the build error below referenced in several messages, but haven't seen a clear answer for how to resolve it.

Environment: XP Pro with MSys/MinGW freshly installed according to the docs here: http://www.postgresql.org/docs/faqs.FAQ_MINGW.html
Zlib is installed; Visual Studio and Cygwin are also on the system but should be out of the way.

Reason for building: increase NAMEDATALEN so it'll quit truncating my absurdly-large column names.

Output from Make (substantially the same whether I'm building 8.2.4 or 8.1.0):

pmills(at)ITLPT9060 /c/postgresql-8.2.4
$ make
make -C doc all
make[1]: Entering directory `/c/postgresql-8.2.4/doc'
make[1]: Nothing to be done for `all'.
make[1]: Leaving directory `/c/postgresql-8.2.4/doc'
make -C src all
make[1]: Entering directory `/c/postgresql-8.2.4/src'
make -C port all
make[2]: Entering directory `/c/postgresql-8.2.4/src/port'
gcc -O2 -Wall -Wmissing-prototypes -Wpointer-arith -Winline -Wdeclaration-after- statement -Wendif-labels -fno-strict-aliasing -I../../src/port -DFRONTEND -I../. ./src/include -I./src/include/port/win32 -DEXEC_BACKEND "-I../../src/include/po rt/win32" -c -o getrusage.o getrusage.c
In file included from ../../src/include/rusagestub.h:17,
from getrusage.c:18:
c:/mingw/bin/../lib/gcc/mingw32/3.4.2/../../../../include/sys/time.h:27: error: redefinition of `struct timezone'
c:/mingw/bin/../lib/gcc/mingw32/3.4.2/../../../../include/sys/time.h:40: error: conflicting types for 'gettimeofday'
../../src/include/port.h:292: error: previous declaration of 'gettimeofday' was here
c:/mingw/bin/../lib/gcc/mingw32/3.4.2/../../../../include/sys/time.h:40: error: conflicting types for 'gettimeofday'
../../src/include/port.h:292: error: previous declaration of 'gettimeofday' was here
make[2]: *** [getrusage.o] Error 1
make[2]: Leaving directory `/c/postgresql-8.2.4/src/port'
make[1]: *** [all] Error 2
make[1]: Leaving directory `/c/postgresql-8.2.4/src'
make: *** [all] Error 2

pmills(at)ITLPT9060 /c/postgresql-8.2.4
$

Could someone please provide either:
* Better instructions for how to install/configure MSys and MinGW
or
* Better instructions for how to compile Postgres using MinGW?

This email and any attachments are confidential, may be attorney-client privileged and are intended only for the use of the addressee. Unauthorized use, distribution or copying is forbidden and may be unlawful. If you have received this email in error, please notify the sender immediately by return email and delete all copies of this message and any attachments from your computer. Thank you.


From: <Match(dot)Grun(at)thomson(dot)com>
To: <PMills(at)veeco(dot)com>, <pgsql-ports(at)postgresql(dot)org>
Subject: Re: Compilation failure: 8.2.4 and 8.1.0 under XPPro/MinGW
Date: 2007-07-03 21:45:25
Message-ID: 4AAF1740D046264BAD7CF21F81BADE5A04474DAE@tshuscodenmbx01.ERF.THOMSON.COM
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-ports

Phil,

I found the same problem. It seems that MinGW has a broken header file.
I made the following changes:

In MinGW/include/sys/time.h

--------- Cut here ------------
#ifndef __MINGW_H
/* Provided for compatibility with code that assumes that
the presence of gettimeofday function implies a definition
of struct timezone. */
struct timezone
{
int tz_minuteswest; /* of Greenwich */
int tz_dsttime; /* type of dst correction to apply */
};

/*
Implementation as per:
The Open Group Base Specifications, Issue 6
IEEE Std 1003.1, 2004 Edition

The timezone pointer arg is ignored. Errors are ignored.
*/
int __cdecl gettimeofday(struct timeval *__restrict__,
void *__restrict__ /* tzp (unused) */);
#endif
--------- Cut here ------------

This is not documented anywhere. On the postgres site or the mingw
sites.
Hope that helps.

Match

-----Original Message-----
From: pgsql-ports-owner(at)postgresql(dot)org
[mailto:pgsql-ports-owner(at)postgresql(dot)org] On Behalf Of Phil Mills
Sent: Tuesday, July 03, 2007 3:30 PM
To: pgsql-ports(at)postgresql(dot)org
Subject: [PORTS] Compilation failure: 8.2.4 and 8.1.0 under XPPro/MinGW

I've seen the build error below referenced in several messages, but
haven't seen a clear answer for how to resolve it.

Environment: XP Pro with MSys/MinGW freshly installed according to the
docs here: http://www.postgresql.org/docs/faqs.FAQ_MINGW.html
Zlib is installed; Visual Studio and Cygwin are also on the system but
should be out of the way.

Reason for building: increase NAMEDATALEN so it'll quit truncating my
absurdly-large column names.

Output from Make (substantially the same whether I'm building 8.2.4 or
8.1.0):

pmills(at)ITLPT9060 /c/postgresql-8.2.4
$ make
make -C doc all
make[1]: Entering directory `/c/postgresql-8.2.4/doc'
make[1]: Nothing to be done for `all'.
make[1]: Leaving directory `/c/postgresql-8.2.4/doc'
make -C src all
make[1]: Entering directory `/c/postgresql-8.2.4/src'
make -C port all
make[2]: Entering directory `/c/postgresql-8.2.4/src/port'
gcc -O2 -Wall -Wmissing-prototypes -Wpointer-arith -Winline
-Wdeclaration-after- statement
-Wendif-labels -fno-strict-aliasing -I../../src/port -DFRONTEND -I../.
./src/include -I./src/include/port/win32 -DEXEC_BACKEND
"-I../../src/include/po rt/win32" -c -o
getrusage.o getrusage.c
In file included from ../../src/include/rusagestub.h:17,
from getrusage.c:18:
c:/mingw/bin/../lib/gcc/mingw32/3.4.2/../../../../include/sys/time.h:27:
error: redefinition of `struct timezone'
c:/mingw/bin/../lib/gcc/mingw32/3.4.2/../../../../include/sys/time.h:40:
error: conflicting types for 'gettimeofday'
../../src/include/port.h:292: error: previous declaration of
'gettimeofday' was here
c:/mingw/bin/../lib/gcc/mingw32/3.4.2/../../../../include/sys/time.h:40:
error: conflicting types for 'gettimeofday'
../../src/include/port.h:292: error: previous declaration of
'gettimeofday' was here
make[2]: *** [getrusage.o] Error 1
make[2]: Leaving directory `/c/postgresql-8.2.4/src/port'
make[1]: *** [all] Error 2
make[1]: Leaving directory `/c/postgresql-8.2.4/src'
make: *** [all] Error 2

pmills(at)ITLPT9060 /c/postgresql-8.2.4
$

Could someone please provide either:
* Better instructions for how to install/configure MSys and MinGW or
* Better instructions for how to compile Postgres using MinGW?

This email and any attachments are confidential, may be attorney-client
privileged and are intended only for the use of the addressee.
Unauthorized use, distribution or copying is forbidden and may be
unlawful. If you have received this email in error, please notify the
sender immediately by return email and delete all copies of this message
and any attachments from your computer. Thank you.

---------------------------(end of broadcast)---------------------------
TIP 2: Don't 'kill -9' the postmaster


From: Magnus Hagander <magnus(at)hagander(dot)net>
To: Phil Mills <PMills(at)veeco(dot)com>
Cc: pgsql-ports(at)postgresql(dot)org
Subject: Re: Compilation failure: 8.2.4 and 8.1.0 under XPPro/MinGW
Date: 2007-07-05 05:11:03
Message-ID: 468C7D67.3090509@hagander.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-ports

Phil Mills wrote:
> I've seen the build error below referenced in several messages, but haven't seen a clear answer for how to resolve it.
>
> Environment: XP Pro with MSys/MinGW freshly installed according to the docs here: http://www.postgresql.org/docs/faqs.FAQ_MINGW.html
> Zlib is installed; Visual Studio and Cygwin are also on the system but should be out of the way.
>
> Reason for building: increase NAMEDATALEN so it'll quit truncating my absurdly-large column names.
>
> Output from Make (substantially the same whether I'm building 8.2.4 or 8.1.0):
<snip>

This means your MingW is too new :-O
They made an incompatible change to their headers at some point (I think
someone said you need 3.9 or earlier). So your workaround is to
downgrade to an older version of mingw. (Or do the manual header hackery
that someone posted, but I'd really recommend something that works
without changing the libc headers)

Now that I see it again, I do think I have a patch sitting around
somewhere to fix that, I guess I'll have to find and review that one. If
we can't fix it, we at least need to get it into the FAQ. I'll write up
a suggestion for text there if I can't get the code fixed.

Unfortunately, keeping up with mingw is developing against a moving
target, so these things happen :-(

//Magnus