Thread: BUG #5707: Cross compilation for windows is broken

BUG #5707: Cross compilation for windows is broken

From
"Richard Evans"
Date:
The following bug has been logged online:

Bug reference:      5707
Logged by:          Richard Evans
Email address:      richard.evans@datanomic.com
PostgreSQL version: 9.0.1
Operating system:   Linux (Fedora 12)
Description:        Cross compilation for windows is broken
Details:

When cross compiling for Windows using a separate build area, libpq.dll does
not build because the .def file cannot be found.

This appears to be caused by these lines in Makefile.shlib:

# If SHLIB_EXPORTS is set, the rules below will build a .def file from
# that.  Else we build a temporary one here.
ifeq (,$(SHLIB_EXPORTS))
DLL_DEFFILE = lib$(NAME)dll.def
exports_file = $(DLL_DEFFILE)

$(exports_file): $(OBJS)
    $(DLLTOOL) --export-all $(DLLTOOL_DEFFLAGS) --output-def $@ $^
else
DLL_DEFFILE = lib$(NAME)dll.def
endif

In Makefile.shlib from 8.4.5, the lines read:

# If SHLIB_EXPORTS is set, the rules below will build a .def file from
# that.  Else we build a temporary one here.
ifeq (,$(SHLIB_EXPORTS))
DLL_DEFFILE = lib$(NAME)dll.def
exports_file = $(DLL_DEFFILE)

$(exports_file): $(OBJS)
    $(DLLTOOL) --export-all $(DLLTOOL_DEFFLAGS) --output-def $@ $^
else
DLL_DEFFILE = $(srcdir)/lib$(NAME)dll.def
endif

Note the reference fo ${srcdir).  If Makefile.shlib in 9.0.1 is updated to
match this, the build succeeds.

The configure command was somethinglike:

~/misc/postgresql-9.0.1/configure --host=mingw32 --prefix=/tmp/pg9
--without-zlib

Re: BUG #5707: Cross compilation for windows is broken

From
Alvaro Herrera
Date:
Excerpts from Richard Evans's message of mar oct 12 12:48:45 -0300 2010:

> When cross compiling for Windows using a separate build area, libpq.dll does
> not build because the .def file cannot be found.
>
> This appears to be caused by these lines in Makefile.shlib:

Hmm, apparently this was made to work here:
http://git.postgresql.org/gitweb?p=postgresql.git;a=commitdiff;h=26af72b4

and subsequently broken later:
http://git.postgresql.org/gitweb?p=postgresql.git;a=commitdiff;h=234c7ce9

I think the real fix is to make the DEF files be generated in the
builddir, to complete the intention of the latter patch.

--
Álvaro Herrera <alvherre@commandprompt.com>
The PostgreSQL Company - Command Prompt, Inc.
PostgreSQL Replication, Consulting, Custom Development, 24x7 support

Re: BUG #5707: Cross compilation for windows is broken

From
Robert Haas
Date:
On Tue, Oct 12, 2010 at 2:25 PM, Alvaro Herrera
<alvherre@commandprompt.com> wrote:
> Excerpts from Richard Evans's message of mar oct 12 12:48:45 -0300 2010:
>
>> When cross compiling for Windows using a separate build area, libpq.dll does
>> not build because the .def file cannot be found.
>>
>> This appears to be caused by these lines in Makefile.shlib:
>
> Hmm, apparently this was made to work here:
> http://git.postgresql.org/gitweb?p=postgresql.git;a=commitdiff;h=26af72b4
>
> and subsequently broken later:
> http://git.postgresql.org/gitweb?p=postgresql.git;a=commitdiff;h=234c7ce9
>
> I think the real fix is to make the DEF files be generated in the
> builddir, to complete the intention of the latter patch.

Is anyone working on that?

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

Re: BUG #5707: Cross compilation for windows is broken

From
Alvaro Herrera
Date:
Excerpts from Robert Haas's message of vie oct 29 13:23:39 -0300 2010:
> On Tue, Oct 12, 2010 at 2:25 PM, Alvaro Herrera
> <alvherre@commandprompt.com> wrote:
> > Excerpts from Richard Evans's message of mar oct 12 12:48:45 -0300 2010:
> >
> >> When cross compiling for Windows using a separate build area, libpq.dll does
> >> not build because the .def file cannot be found.
> >>
> >> This appears to be caused by these lines in Makefile.shlib:
> >
> > Hmm, apparently this was made to work here:
> > http://git.postgresql.org/gitweb?p=postgresql.git;a=commitdiff;h=26af72b4
> >
> > and subsequently broken later:
> > http://git.postgresql.org/gitweb?p=postgresql.git;a=commitdiff;h=234c7ce9
> >
> > I think the real fix is to make the DEF files be generated in the
> > builddir, to complete the intention of the latter patch.
>
> Is anyone working on that?

Not me.  I tried, but mingw32-gcc doesn't work out of the box for me,
because configure is not testing for the right accept() arguments.
That's what I can do with the time I can dedicate to a problem like this
right now (i.e. not much).

--
Álvaro Herrera <alvherre@commandprompt.com>
The PostgreSQL Company - Command Prompt, Inc.
PostgreSQL Replication, Consulting, Custom Development, 24x7 support

Re: BUG #5707: Cross compilation for windows is broken

From
Bruce Momjian
Date:
Has this been addressed?

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

Alvaro Herrera wrote:
> Excerpts from Robert Haas's message of vie oct 29 13:23:39 -0300 2010:
> > On Tue, Oct 12, 2010 at 2:25 PM, Alvaro Herrera
> > <alvherre@commandprompt.com> wrote:
> > > Excerpts from Richard Evans's message of mar oct 12 12:48:45 -0300 2010:
> > >
> > >> When cross compiling for Windows using a separate build area, libpq.dll does
> > >> not build because the .def file cannot be found.
> > >>
> > >> This appears to be caused by these lines in Makefile.shlib:
> > >
> > > Hmm, apparently this was made to work here:
> > > http://git.postgresql.org/gitweb?p=postgresql.git;a=commitdiff;h=26af72b4
> > >
> > > and subsequently broken later:
> > > http://git.postgresql.org/gitweb?p=postgresql.git;a=commitdiff;h=234c7ce9
> > >
> > > I think the real fix is to make the DEF files be generated in the
> > > builddir, to complete the intention of the latter patch.
> >
> > Is anyone working on that?
>
> Not me.  I tried, but mingw32-gcc doesn't work out of the box for me,
> because configure is not testing for the right accept() arguments.
> That's what I can do with the time I can dedicate to a problem like this
> right now (i.e. not much).
>
> --
> Álvaro Herrera <alvherre@commandprompt.com>
> The PostgreSQL Company - Command Prompt, Inc.
> PostgreSQL Replication, Consulting, Custom Development, 24x7 support
>
> --
> Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-bugs

--
  Bruce Momjian  <bruce@momjian.us>        http://momjian.us
  EnterpriseDB                             http://enterprisedb.com

  + It's impossible for everything to be true. +

Re: BUG #5707: Cross compilation for windows is broken

From
Robert Haas
Date:
On Sat, Feb 26, 2011 at 2:14 AM, Bruce Momjian <bruce@momjian.us> wrote:
> Has this been addressed?

Not me.  Sounds like no one cares enough to figure out how to do this.
 Perhaps this should be a TODO.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

Re: BUG #5707: Cross compilation for windows is broken

From
Bruce Momjian
Date:
Robert Haas wrote:
> On Sat, Feb 26, 2011 at 2:14 AM, Bruce Momjian <bruce@momjian.us> wrote:
> > Has this been addressed?
>
> Not me.  Sounds like no one cares enough to figure out how to do this.
>  Perhaps this should be a TODO.

Agreed.  TODO added:

    Fix cross-compiling on Windows

        * http://archives.postgresql.org/pgsql-bugs/2010-10/msg00110.php

--
  Bruce Momjian  <bruce@momjian.us>        http://momjian.us
  EnterpriseDB                             http://enterprisedb.com

  + It's impossible for everything to be true. +