Thread: compiling postgres in winxp

compiling postgres in winxp

From
"Jaime Casanova"
Date:
Hi,

i'm trying to compile postgres in winxp for the first time in order to
try recent Magnus patch discussed here
http://archives.postgresql.org/pgsql-hackers/2007-11/msg01307.php

i've installed mingw, msys and msysDTK

i tried "./configure --without-zlib" and then "make install" and get this error.

someone can give a me a clue here?

make[2]: Entering directory `/home/General/postgresql-8.2.5/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/port/win32"  -c -o getrusage.o getrusage.c
In file included from ../../src/include/rusagestub.h:17,                from getrusage.c:18:
/mingw/lib/gcc/mingw32/3.4.5/../../../../include/sys/time.h:27: error:
redefinition of `struct timezone'
/mingw/lib/gcc/mingw32/3.4.5/../../../../include/sys/time.h:40: error:
conflicting types for 'gettimeofday'
../../src/include/port.h:292: error: previous declaration of
'gettimeofday' was here
/mingw/lib/gcc/mingw32/3.4.5/../../../../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 `/home/General/postgresql-8.2.5/src/port'
make[1]: *** [install] Error 2
make[1]: Leaving directory `/home/General/postgresql-8.2.5/src'
make: *** [install] Error 2


-- 
regards,
Jaime Casanova

"Programming today is a race between software engineers striving to
build bigger and better idiot-proof programs and the universe trying
to produce bigger and better idiots.
So far, the universe is winning."                                      Richard Cook


Re: compiling postgres in winxp

From
Kris Jurka
Date:

On Sat, 1 Dec 2007, Jaime Casanova wrote:

> i'm trying to compile postgres in winxp for the first time in order to
> try recent Magnus patch discussed here
> http://archives.postgresql.org/pgsql-hackers/2007-11/msg01307.php
>
> /mingw/lib/gcc/mingw32/3.4.5/../../../../include/sys/time.h:27: error:
> redefinition of `struct timezone'
> /mingw/lib/gcc/mingw32/3.4.5/../../../../include/sys/time.h:40: error:
> conflicting types for 'gettimeofday'
> .../../src/include/port.h:292: error: previous declaration of
> 'gettimeofday' was here

Only very recently can the 8.2 release be built with recent mingw 
releases.  Upgrade pg to the top of REL8_2_STABLE or downgrade mingw.

http://archives.postgresql.org/pgsql-committers/2007-11/msg00566.php

Kris Jurka


Re: compiling postgres in winxp

From
Date:
Any Code::Blocks user?  http://www.codeblocks.org/
Cannot compile PG-8.2.5 with WinXP SP2 using Code::Blocks.
I created a new project including ALL the files decompressed from 
postgresql-8.2.5.tar.gz
and then just clicked on "build". What's wrong?

Alternative ways to complie it with other IDE or any precise command line?

The error messages when building it are:

Project : Console application
Compiler : GNU GCC Compiler (called directly)
Directory : C:\Documents and Settings\manolo\Desktop\postgresql-8.2.5\
--------------------------------------------------------------------------------
Switching to target: default
Compiling: contrib\adminpack\adminpack.c
contrib\adminpack\adminpack.c:15:22: postgres.h: No such file or directory
contrib\adminpack\adminpack.c:21:29: catalog/pg_type.h: No such file or 
directory
contrib\adminpack\adminpack.c:22:21: funcapi.h: No such file or directory
contrib\adminpack\adminpack.c:23:23: miscadmin.h: No such file or directory
contrib\adminpack\adminpack.c:24:34: postmaster/syslogger.h: No such file or 
directory
contrib\adminpack\adminpack.c:25:24: storage/fd.h: No such file or directory
contrib\adminpack\adminpack.c:26:28: utils/datetime.h: No such file or 
directory
contrib\adminpack\adminpack.c:40: warning: data definition has no type or 
storage class
contrib\adminpack\adminpack.c:42: error: syntax error before "pg_file_write"
contrib\adminpack\adminpack.c:42: warning: parameter names (without types) 
in function declaration
contrib\adminpack\adminpack.c:42: warning: data definition has no type or 
storage class
contrib\adminpack\adminpack.c:43: error: syntax error before 
"pg_file_rename"
contrib\adminpack\adminpack.c:43: warning: parameter names (without types) 
in function declaration
contrib\adminpack\adminpack.c:43: warning: data definition has no type or 
storage class
contrib\adminpack\adminpack.c:44: error: syntax error before 
"pg_file_unlink"
contrib\adminpack\adminpack.c:44: warning: parameter names (without types) 
in function declaration
contrib\adminpack\adminpack.c:44: warning: data definition has no type or 
storage class
contrib\adminpack\adminpack.c:45: error: syntax error before "pg_logdir_ls"
contrib\adminpack\adminpack.c:45: warning: parameter names (without types) 
in function declaration
contrib\adminpack\adminpack.c:45: warning: data definition has no type or 
storage class
contrib\adminpack\adminpack.c:47: warning: parameter names (without types) 
in function declaration
contrib\adminpack\adminpack.c:47: warning: data definition has no type or 
storage class
contrib\adminpack\adminpack.c:48: warning: parameter names (without types) 
in function declaration
contrib\adminpack\adminpack.c:48: warning: data definition has no type or 
storage class
contrib\adminpack\adminpack.c:49: warning: parameter names (without types) 
in function declaration
contrib\adminpack\adminpack.c:49: warning: data definition has no type or 
storage class
contrib\adminpack\adminpack.c:50: warning: parameter names (without types) 
in function declaration
contrib\adminpack\adminpack.c:50: warning: data definition has no type or 
storage class
contrib\adminpack\adminpack.c:55: error: syntax error before "DIR"
contrib\adminpack\adminpack.c:55: warning: no semicolon at end of struct or 
union
contrib\adminpack\adminpack.c:56: warning: data definition has no type or 
storage class
contrib\adminpack\adminpack.c:69: error: syntax error before '*' token
contrib\adminpack\adminpack.c: In function `convert_and_check_filename':
contrib\adminpack\adminpack.c:71: error: `arg' undeclared (first use in this 
function)
contrib\adminpack\adminpack.c:71: error: (Each undeclared identifier is 
reported only once
contrib\adminpack\adminpack.c:71: error: for each function it appears in.)
contrib\adminpack\adminpack.c:71: error: `VARHDRSZ' undeclared (first use in 
this function)
contrib\adminpack\adminpack.c:72: warning: initialization makes pointer from 
integer without a cast
contrib\adminpack\adminpack.c:74: warning: passing arg 2 of `memcpy' makes 
pointer from integer without a cast
contrib\adminpack\adminpack.c:81: error: `ERROR' undeclared (first use in 
this function)
contrib\adminpack\adminpack.c:82: error: `ERRCODE_INSUFFICIENT_PRIVILEGE' 
undeclared (first use in this function)
contrib\adminpack\adminpack.c:88: error: `DataDir' undeclared (first use in 
this function)
contrib\adminpack\adminpack.c:91: error: `logAllowed' undeclared (first use 
in this function)
contrib\adminpack\adminpack.c:92: error: `Log_directory' undeclared (first 
use in this function)
contrib\adminpack\adminpack.c:99: error: `NULL' undeclared (first use in 
this function)
contrib\adminpack\adminpack.c: In function `requireSuperuser':
contrib\adminpack\adminpack.c:115: error: `ERROR' undeclared (first use in 
this function)
contrib\adminpack\adminpack.c:116: error: `ERRCODE_INSUFFICIENT_PRIVILEGE' 
undeclared (first use in this function)
contrib\adminpack\adminpack.c: At top level:
contrib\adminpack\adminpack.c:127: error: syntax error before 
"pg_file_write"
contrib\adminpack\adminpack.c: In function `pg_file_write':
contrib\adminpack\adminpack.c:129: error: `FILE' undeclared (first use in 
this function)
contrib\adminpack\adminpack.c:129: error: `f' undeclared (first use in this 
function)
contrib\adminpack\adminpack.c:131: error: `text' undeclared (first use in 
this function)
contrib\adminpack\adminpack.c:131: error: `data' undeclared (first use in 
this function)
contrib\adminpack\adminpack.c:132: error: `int64' undeclared (first use in 
this function)
contrib\adminpack\adminpack.c:132: error: syntax error before "count"
contrib\adminpack\adminpack.c:136: error: `false' undeclared (first use in 
this function)
contrib\adminpack\adminpack.c:144: error: `ERROR' undeclared (first use in 
this function)
contrib\adminpack\adminpack.c:145: error: `ERRCODE_DUPLICATE_FILE' 
undeclared (first use in this function)
contrib\adminpack\adminpack.c:161: error: `count' undeclared (first use in 
this function)
contrib\adminpack\adminpack.c:161: error: `VARHDRSZ' undeclared (first use 
in this function)
contrib\adminpack\adminpack.c:161: warning: passing arg 1 of `fwrite' makes 
pointer from integer without a cast
contrib\adminpack\adminpack.c: At top level:
contrib\adminpack\adminpack.c:175: error: syntax error before 
"pg_file_rename"
contrib\adminpack\adminpack.c: In function `pg_file_rename':
contrib\adminpack\adminpack.c:187: error: `false' undeclared (first use in 
this function)
contrib\adminpack\adminpack.c:196: error: `WARNING' undeclared (first use in 
this function)
contrib\adminpack\adminpack.c:213: error: `errno' undeclared (first use in 
this function)
contrib\adminpack\adminpack.c:213: error: `ENOENT' undeclared (first use in 
this function)
contrib\adminpack\adminpack.c:215: error: `ERROR' undeclared (first use in 
this function)
contrib\adminpack\adminpack.c:216: error: `ERRCODE_DUPLICATE_FILE' 
undeclared (first use in this function)
contrib\adminpack\adminpack.c:247: error: `ERRCODE_UNDEFINED_FILE' 
undeclared (first use in this function)
contrib\adminpack\adminpack.c:260: error: `true' undeclared (first use in 
this function)
contrib\adminpack\adminpack.c: At top level:
contrib\adminpack\adminpack.c:265: error: syntax error before 
"pg_file_unlink"
contrib\adminpack\adminpack.c: In function `pg_file_unlink':
contrib\adminpack\adminpack.c:271: error: `false' undeclared (first use in 
this function)
contrib\adminpack\adminpack.c:275: error: `errno' undeclared (first use in 
this function)
contrib\adminpack\adminpack.c:275: error: `ENOENT' undeclared (first use in 
this function)
Process terminated with status 1 (0 minutes, 19 seconds)
52 errors, 22 warnings


--------------------------------------------------
From: "Kris Jurka" <books@ejurka.com>
Sent: Saturday, December 01, 2007 7:41 AM
To: "Jaime Casanova" <systemguards@gmail.com>
Cc: "PostgreSQL-development" <pgsql-hackers@postgresql.org>
Subject: Re: [HACKERS] compiling postgres in winxp

>
>
> On Sat, 1 Dec 2007, Jaime Casanova wrote:
>
>> i'm trying to compile postgres in winxp for the first time in order to
>> try recent Magnus patch discussed here
>> http://archives.postgresql.org/pgsql-hackers/2007-11/msg01307.php
>>
>> /mingw/lib/gcc/mingw32/3.4.5/../../../../include/sys/time.h:27: error:
>> redefinition of `struct timezone'
>> /mingw/lib/gcc/mingw32/3.4.5/../../../../include/sys/time.h:40: error:
>> conflicting types for 'gettimeofday'
>> .../../src/include/port.h:292: error: previous declaration of
>> 'gettimeofday' was here
>
> Only very recently can the 8.2 release be built with recent mingw 
> releases.  Upgrade pg to the top of REL8_2_STABLE or downgrade mingw.
>
> http://archives.postgresql.org/pgsql-committers/2007-11/msg00566.php
>
> Kris Jurka
>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: Don't 'kill -9' the postmaster
> 



Re: compiling postgres in winxp

From
Andrew Dunstan
Date:

mac_man2005@hotmail.it wrote:
> Any Code::Blocks user?  http://www.codeblocks.org/
> Cannot compile PG-8.2.5 with WinXP SP2 using Code::Blocks.
>
> I created a new project including ALL the files decompressed from 
> postgresql-8.2.5.tar.gz
> and then just clicked on "build". What's wrong?
>
> Alternative ways to complie it with other IDE or any precise command 
> line?
>
>

What's wrong is that you have not followed any of the instructions for 
building Postgres.

There are only two known ways to build on Windows: using either Mingw or 
MSVC. The latter only really works with the HEAD branch, not the 
released branches.

Please read the docs before just trying to build blind like this.

cheers

andrew