Thread: compiling on windows with mingw

compiling on windows with mingw

From
"Gevik babakhani"
Date:
<div class="Section1"><p class="MsoNormal"><font face="Arial" size="2"><span style="font-size:10.0pt;
font-family:Arial">I would like to compile the code on windows. I understand I need mingw. </span></font><p
class="MsoNormal"><fontface="Arial" size="2"><span style="font-size:10.0pt; 
font-family:Arial">on the mingw site there are may packages to download and install.</span></font><p
class="MsoNormal"><fontface="Arial" size="2"><span style="font-size:10.0pt; 
font-family:Arial"> </span></font><p class="MsoNormal"><font face="Arial" size="2"><span style="font-size:10.0pt;
font-family:Arial">Does anyone know which ones to download install in order to compile pg.</span></font><p
class="MsoNormal"><fontface="Arial" size="2"><span style="font-size:10.0pt; 
font-family:Arial"> </span></font><p class="MsoNormal"><font face="Arial" size="2"><span style="font-size:10.0pt;
font-family:Arial">Thanx,</span></font><p class="MsoNormal"><font face="Arial" size="2"><span style="font-size:10.0pt;
font-family:Arial">Gevik.</span></font><p class="MsoNormal"><font face="Arial" size="2"><span style="font-size:10.0pt;
font-family:Arial"> </span></font></div>

Re: compiling on windows with mingw

From
Adrian Maier
Date:
Gevik babakhani wrote:
> I would like to compile the code on windows. I understand I need mingw.
> 
> on the mingw site there are may packages to download and install.
>  
> Does anyone know which ones to download install in order to compile pg.

Hi Gevik,

When I last installed mingw I've downloaded only 2 files (bundles)
MinGW-?.?.?.exe and MSYS-?.?.?.exe.


Adrian Maier

> Thanx,
> 
> Gevik.
> 
>  
> 



Re: compiling on windows with mingw

From
Petr Jelinek
Date:
Gevik babakhani wrote:

> 
> I would like to compile the code on windows. I understand I need mingw.
> 
> on the mingw site there are may packages to download and install.
> 
> Does anyone know which ones to download install in order to compile pg.
> 

MingW-x.x.x.exe

and MSYS-x.x.x.exe

and you have to build it from msys shell.

If you want to build cvs sources, you also need flex and bison.


-- 
Regards
Petr Jelinek (PJMODOS)
www.parba.cz


Re: compiling on windows with mingw

From
Andrew Dunstan
Date:

Petr Jelinek wrote:

> Gevik babakhani wrote:
>
>>
>> I would like to compile the code on windows. I understand I need mingw.
>>
>> on the mingw site there are may packages to download and install.
>>
>> Does anyone know which ones to download install in order to compile pg.
>>
>
> MingW-x.x.x.exe
>
> and MSYS-x.x.x.exe
>
> and you have to build it from msys shell.
>
> If you want to build cvs sources, you also need flex and bison.
>

The DTK is also useful, possibly even necessary for building with CVS.

cheers

andrew


Re: compiling on windows with mingw

From
"Kevin Grittner"
Date:
We have spent a lot of time on this to be able to do Windows builds
during the beta cycle.  Our DBA manager is going to start with a
fresh machine and attempt to do a full setup from our existing notes
and produce a "how to" document.  When we have this, somebody
here will submit it to the community in hopes the it can be included
in the documentation and will help others.

In the meantime, I'll try to extract something from my notes here on
what we did on a fresh machine to get the 8.1.0 release running on
a fresh Windows Server 2003 machine.

Install msys.1.9.10.exe -- taking all defaults.
Install MinGW-4.1.1.exe -- taking all defaults.
From an msys shell, update /etc/fstab as recommended:

C:/MinGW /mingw

Get a fresh msys window and execute gcc --version
to confirm that things are set up right so far.

Install bison-1.875-4.exe changing directory to C:\GnuWin32 (We had problems with the space-embedded derault path.)
Install flex-2.5.4a-1.exe -- taking defaults (It picked up the C:\GnuWin32 from previous install.)
Install zlib-1.2.3.exe -- taking defaults (same)

Update /etc/fstab to add a mount point for C:\GnuWin32.
Update /etc/profile to add /gnuwin32/bin to the msys PATH.
(The previous step may not be needed if you do the following step.)
Add C:\GnuWin32\bin to the Windows Path environment variable.
(I don't remember why we did that -- something wasn't working and
we fixed it that way.)

Unzip zlib-1.2.3-lib.zip on top of mingw directory.
(This corrected run-time problems.)

Using Windows management applications, create a postgres user
with no group memberships.

(Somehow we had a /home/postgres dir -- don't remember how
we created it -- might matter because of permissions.)
Copy postgresql-8.1.0.tar.gz into \msys\1.0\home\postgres dir.

From a cmd window >runas /user:postgres cmd
From the resulting cmd window: > cd \msys\1.0.\bin > C:\msys\1.0\msys.bat
From the resulting msys window (as postgres): $ cd /home/postgres $ tar -xzf postgresql-8.1.0.tar.gz $ cd
postgresql-8.1.0$ ./configure <your preferred switches here> $ make $ make check
 

Open an msys window as administrator. $ cd /home/postgres/postgresql-8.1.0/ $ make install

Using explorer copy C:\msys\1.0\local\pgsql to your preferred
location.  (We used C:\pgsql.)
Add to the Windows Path environment variable: C:\pgsql\bin;C:\pgsql\lib

Add postgres to the Users group (needed just for this step).
Get cmd session as postgres.
Make your directories.  For example: > G: > mkdir pgsql > mkdir pgsql\data > initdb <your preferred switches here>

Remove the Users group from the postgres login.

At this point we could run pg_ctl to start the postmaster.
We still needed to modify the conf files, and set up the
Windows service for PostgreSQL.

I'm only reporting what worked for us.  Use at your own risk,
as there may be better practice documented that we've missed,
and this represents preliminary notes on a single successful
install.  (As always, comments and pointers welcome.)

I hope it is of some help.

-Kevin


>>> "Gevik babakhani" <gevik@xs4all.nl>  >>>
I would like to compile the code on windows. I understand I need mingw. 

on the mingw site there are may packages to download and install.


Does anyone know which ones to download install in order to compile pg.


Thanx,

Gevik.





Re: compiling on windows with mingw

From
Bruce Momjian
Date:
You made no mention that you read our FAQ_MINGW file, which is the
definitive document on how to build on Win32.

---------------------------------------------------------------------------

Kevin Grittner wrote:
> We have spent a lot of time on this to be able to do Windows builds
> during the beta cycle.  Our DBA manager is going to start with a
> fresh machine and attempt to do a full setup from our existing notes
> and produce a "how to" document.  When we have this, somebody
> here will submit it to the community in hopes the it can be included
> in the documentation and will help others.
> 
> In the meantime, I'll try to extract something from my notes here on
> what we did on a fresh machine to get the 8.1.0 release running on
> a fresh Windows Server 2003 machine.
> 
> Install msys.1.9.10.exe -- taking all defaults.
> Install MinGW-4.1.1.exe -- taking all defaults.
> >From an msys shell, update /etc/fstab as recommended:
> 
> C:/MinGW /mingw
> 
> Get a fresh msys window and execute gcc --version
> to confirm that things are set up right so far.
> 
> Install bison-1.875-4.exe changing directory to C:\GnuWin32
>   (We had problems with the space-embedded derault path.)
> Install flex-2.5.4a-1.exe -- taking defaults
>   (It picked up the C:\GnuWin32 from previous install.)
> Install zlib-1.2.3.exe -- taking defaults (same)
> 
> Update /etc/fstab to add a mount point for C:\GnuWin32.
> Update /etc/profile to add /gnuwin32/bin to the msys PATH.
> (The previous step may not be needed if you do the following step.)
> Add C:\GnuWin32\bin to the Windows Path environment variable.
> (I don't remember why we did that -- something wasn't working and
> we fixed it that way.)
> 
> Unzip zlib-1.2.3-lib.zip on top of mingw directory.
> (This corrected run-time problems.)
> 
> Using Windows management applications, create a postgres user
> with no group memberships.
> 
> (Somehow we had a /home/postgres dir -- don't remember how
> we created it -- might matter because of permissions.)
> Copy postgresql-8.1.0.tar.gz into \msys\1.0\home\postgres dir.
> 
> >From a cmd window >runas /user:postgres cmd
> >From the resulting cmd window:
>   > cd \msys\1.0.\bin
>   > C:\msys\1.0\msys.bat
> >From the resulting msys window (as postgres):
>   $ cd /home/postgres
>   $ tar -xzf postgresql-8.1.0.tar.gz
>   $ cd postgresql-8.1.0
>   $ ./configure <your preferred switches here>
>   $ make
>   $ make check
> 
> Open an msys window as administrator.
>   $ cd /home/postgres/postgresql-8.1.0/
>   $ make install
> 
> Using explorer copy C:\msys\1.0\local\pgsql to your preferred
> location.  (We used C:\pgsql.)
> Add to the Windows Path environment variable:
>   C:\pgsql\bin;C:\pgsql\lib
> 
> Add postgres to the Users group (needed just for this step).
> Get cmd session as postgres.
> Make your directories.  For example:
>   > G:
>   > mkdir pgsql
>   > mkdir pgsql\data
>   > initdb <your preferred switches here>
> 
> Remove the Users group from the postgres login.
> 
> At this point we could run pg_ctl to start the postmaster.
> We still needed to modify the conf files, and set up the
> Windows service for PostgreSQL.
> 
> I'm only reporting what worked for us.  Use at your own risk,
> as there may be better practice documented that we've missed,
> and this represents preliminary notes on a single successful
> install.  (As always, comments and pointers welcome.)
> 
> I hope it is of some help.
> 
> -Kevin
> 
> 
> >>> "Gevik babakhani" <gevik@xs4all.nl>  >>>
> I would like to compile the code on windows. I understand I need mingw. 
> 
> on the mingw site there are may packages to download and install.
> 
>  
> 
> Does anyone know which ones to download install in order to compile pg.
> 
>  
> 
> Thanx,
> 
> Gevik.
> 
>  
> 
> 
> 
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Have you searched our list archives?
> 
>                http://archives.postgresql.org
> 

--  Bruce Momjian                        |  http://candle.pha.pa.us pgman@candle.pha.pa.us               |  (610)
359-1001+  If your life is a hard drive,     |  13 Roberts Road +  Christ can be your backup.        |  Newtown Square,
Pennsylvania19073
 


Re: compiling on windows with mingw

From
"Kevin Grittner"
Date:
http://www.postgresql.org/docs/faqs.FAQ_MINGW.html

That is where we started, and I should have mentioned it, even
though the post to which I was replying suggested that Gevik had
read that and was looking for more detail.  We hope to contribute
a patch to fill in details; meanwhile, I was hoping I could save
others some time on the learning curve with some information from
my notes.

Thanks for pointing out the FAQ for those who may find this thread
looking for answers.

-Kevin


>>> Bruce Momjian <pgman@candle.pha.pa.us>  >>>

You made no mention that you read our FAQ_MINGW file, which is the
definitive document on how to build on Win32.

---------------------------------------------------------------------------

Kevin Grittner wrote:
> We have spent a lot of time on this to be able to do Windows builds
> during the beta cycle.  Our DBA manager is going to start with a
> fresh machine and attempt to do a full setup from our existing notes
> and produce a "how to" document.  When we have this, somebody
> here will submit it to the community in hopes the it can be included
> in the documentation and will help others.
> 
> In the meantime, I'll try to extract something from my notes here on
> what we did on a fresh machine to get the 8.1.0 release running on
> a fresh Windows Server 2003 machine.
> 
> Install msys.1.9.10.exe -- taking all defaults.
> Install MinGW-4.1.1.exe -- taking all defaults.
> >From an msys shell, update /etc/fstab as recommended:
> 
> C:/MinGW /mingw
> 
> Get a fresh msys window and execute gcc --version
> to confirm that things are set up right so far.
> 
> Install bison-1.875-4.exe changing directory to C:\GnuWin32
>   (We had problems with the space-embedded derault path.)
> Install flex-2.5.4a-1.exe -- taking defaults
>   (It picked up the C:\GnuWin32 from previous install.)
> Install zlib-1.2.3.exe -- taking defaults (same)
> 
> Update /etc/fstab to add a mount point for C:\GnuWin32.
> Update /etc/profile to add /gnuwin32/bin to the msys PATH.
> (The previous step may not be needed if you do the following step.)
> Add C:\GnuWin32\bin to the Windows Path environment variable.
> (I don't remember why we did that -- something wasn't working and
> we fixed it that way.)
> 
> Unzip zlib-1.2.3-lib.zip on top of mingw directory.
> (This corrected run-time problems.)
> 
> Using Windows management applications, create a postgres user
> with no group memberships.
> 
> (Somehow we had a /home/postgres dir -- don't remember how
> we created it -- might matter because of permissions.)
> Copy postgresql-8.1.0.tar.gz into \msys\1.0\home\postgres dir.
> 
> >From a cmd window >runas /user:postgres cmd
> >From the resulting cmd window:
>   > cd \msys\1.0.\bin
>   > C:\msys\1.0\msys.bat
> >From the resulting msys window (as postgres):
>   $ cd /home/postgres
>   $ tar -xzf postgresql-8.1.0.tar.gz
>   $ cd postgresql-8.1.0
>   $ ./configure <your preferred switches here>
>   $ make
>   $ make check
> 
> Open an msys window as administrator.
>   $ cd /home/postgres/postgresql-8.1.0/
>   $ make install
> 
> Using explorer copy C:\msys\1.0\local\pgsql to your preferred
> location.  (We used C:\pgsql.)
> Add to the Windows Path environment variable:
>   C:\pgsql\bin;C:\pgsql\lib
> 
> Add postgres to the Users group (needed just for this step).
> Get cmd session as postgres.
> Make your directories.  For example:
>   > G:
>   > mkdir pgsql
>   > mkdir pgsql\data
>   > initdb <your preferred switches here>
> 
> Remove the Users group from the postgres login.
> 
> At this point we could run pg_ctl to start the postmaster.
> We still needed to modify the conf files, and set up the
> Windows service for PostgreSQL.
> 
> I'm only reporting what worked for us.  Use at your own risk,
> as there may be better practice documented that we've missed,
> and this represents preliminary notes on a single successful
> install.  (As always, comments and pointers welcome.)
> 
> I hope it is of some help.
> 
> -Kevin
> 
> 
> >>> "Gevik babakhani" <gevik@xs4all.nl>  >>>
> I would like to compile the code on windows. I understand I need
mingw. 
> 
> on the mingw site there are may packages to download and install.
> 
>  
> 
> Does anyone know which ones to download install in order to compile
pg.
> 
>  
> 
> Thanx,
> 
> Gevik.
> 
>  
> 
> 
> 
> ---------------------------(end of
broadcast)---------------------------
> TIP 4: Have you searched our list archives?
> 
>                http://archives.postgresql.org
> 

--  Bruce Momjian                        |  http://candle.pha.pa.us pgman@candle.pha.pa.us               |  (610)
359-1001+  If your life is a hard drive,     |  13 Roberts Road +  Christ can be your backup.        |  Newtown Square,
Pennsylvania
19073