Thread: Building Postgres using mingw

Building Postgres using mingw

From
Michael Paquier
Date:
Hi all,

Following some instructions on the wiki and the docs, I am trying to
compile the code using minwg:
https://wiki.postgresql.org/wiki/Building_With_MinGW
http://www.postgresql.org/docs/devel/static/installation-platform-notes.html#INSTALLATION-NOTES-MINGW

After installing mingw-w64 and adding its binaries to PATH, I am able
to complete configure correctly (including finding a compiler with
--host=x86_64-w64-mingw32). However mingw-w64 does not have a make
command included so compilation cannot continue.

I have also installed msysgit to facilitate the work and have already
most of the build dependencies at hand. Something obvious that I may
be missing? Is it better to give up with mingw and switch to msvc?

Regards,
--
Michael


Re: Building Postgres using mingw

From
Adrian Klaver
Date:
On 05/07/2014 08:27 AM, Michael Paquier wrote:
> Hi all,
>
> Following some instructions on the wiki and the docs, I am trying to
> compile the code using minwg:
> https://wiki.postgresql.org/wiki/Building_With_MinGW
> http://www.postgresql.org/docs/devel/static/installation-platform-notes.html#INSTALLATION-NOTES-MINGW
>
> After installing mingw-w64 and adding its binaries to PATH, I am able
> to complete configure correctly (including finding a compiler with
> --host=x86_64-w64-mingw32). However mingw-w64 does not have a make
> command included so compilation cannot continue.

It would seem it does:):

http://sourceforge.net/apps/trac/mingw-w64/wiki/Make

>
> I have also installed msysgit to facilitate the work and have already
> most of the build dependencies at hand. Something obvious that I may
> be missing? Is it better to give up with mingw and switch to msvc?
>
> Regards,
>


--
Adrian Klaver
adrian.klaver@aklaver.com


Re: Building Postgres using mingw

From
Jeff Janes
Date:
On Wed, May 7, 2014 at 8:27 AM, Michael Paquier <michael.paquier@gmail.com> wrote:
Hi all,

Following some instructions on the wiki and the docs, I am trying to
compile the code using minwg:
https://wiki.postgresql.org/wiki/Building_With_MinGW
http://www.postgresql.org/docs/devel/static/installation-platform-notes.html#INSTALLATION-NOTES-MINGW

After installing mingw-w64 and adding its binaries to PATH, I am able
to complete configure correctly (including finding a compiler with
--host=x86_64-w64-mingw32). However mingw-w64 does not have a make
command included so compilation cannot continue.

Did you select the 'developer toolkit' when running the mingw installer?

Cheers,

Jeff

Re: Building Postgres using mingw

From
Michael Paquier
Date:
On Wed, May 7, 2014 at 10:26 AM, Jeff Janes <jeff.janes@gmail.com> wrote:
> On Wed, May 7, 2014 at 8:27 AM, Michael Paquier <michael.paquier@gmail.com>
> wrote:
>>
>> Hi all,
>>
>> Following some instructions on the wiki and the docs, I am trying to
>> compile the code using minwg:
>> https://wiki.postgresql.org/wiki/Building_With_MinGW
>>
>> http://www.postgresql.org/docs/devel/static/installation-platform-notes.html#INSTALLATION-NOTES-MINGW
>>
>> After installing mingw-w64 and adding its binaries to PATH, I am able
>> to complete configure correctly (including finding a compiler with
>> --host=x86_64-w64-mingw32). However mingw-w64 does not have a make
>> command included so compilation cannot continue.
>
>
> Did you select the 'developer toolkit' when running the mingw installer?
Think so... However I finally got it working, and here is a little bit
of feedback for the archive's sake as this is trickier than it seems
at first sight.

When trying to use a recent mingw package, sometimes ./configure is
not able to recognize a compiler even if there is one in PATH. This
worked correctly with the snapshot that Postgres wiki recommends
though, even if it is a couple of years old.

Then, after looking at some mingw builds available on sourceforge, the
make command is sometimes not available, but some of the latest builds
available name it mingw32-make.exe instead of make.exe to not conflict
with msys things. So a quick solution is to copy it as make.exe in
PATH if your environment does not include it yet. But be careful when
doing that.

I also had to enforce some environment variables to the following
values at configure (instead of the default values set to /bin/*
because this was failing):
SHELL=bash
PERL=perl
BISON=bison
FLEX=flex
MKDIR_P="mkdir -p"

I hope that this helps. Perhaps I missed something, so if someone has
better ideas or ways to do that... This has been done on a Win7 dev
box with msysgit installed.
Regards,
--
Michael