pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Noah Misch <noah@leadboat.com>
To: Michael Paquier <michael.paquier@gmail.com>
Cc: MauMau <maumau307@gmail.com>
Cc: Magnus Hagander <magnus@hagander.net>
Cc: pgsql-bugs <pgsql-bugs@postgresql.org>
Subject: Re: Missing file versions for a bunch of dll/exe files in Windows builds
Date: Sat, 1 Aug 2015 22:54:37 -0400
Message-ID: <20150802025437.GA1661249@tornado.leadboat.com> (raw)
In-Reply-To: <20140714190328.GB2088773@tornado.leadboat.com>
References: <CAB7nPqRtY1eikQGmz1_wbVHPvFyvE9VMA67ricepQ6D8-EgwnA@mail.gmail.com>
	<BA403D0A8188444F817198BDAB4F326F@maumau>
	<CAB7nPqTZy5j-Uts4xP=uNFMRVW=oBZAvyjGRGEMWjbDtaN_YZg@mail.gmail.com>
	<7E6471A0DAC54872AE6DFEB393554C77@maumau>
	<CAB7nPqQq-jdQdvaAAeO-ch9qmcA9+K0K9Ry1LTR-SjBA=2KkDA@mail.gmail.com>
	<20140710150244.GA1942769@tornado.leadboat.com>
	<CAB7nPqTozhMdCqXNsDeaBr30ofJpdt2P6u7v=FUA-_Z6tERD3w@mail.gmail.com>
	<20140711133439.GB1947575@tornado.leadboat.com>
	<CAB7nPqQ9D78y6qfXiNwYc92oT2YHK-i6GTkLaMadewzYUHPS9Q@mail.gmail.com>
	<20140714190328.GB2088773@tornado.leadboat.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>

On Mon, Jul 14, 2014 at 03:03:28PM -0400, Noah Misch wrote:
> On Fri, Jul 11, 2014 at 11:14:54PM -0700, Michael Paquier wrote:
> > On Fri, Jul 11, 2014 at 10:34 PM, Noah Misch <noah@leadboat.com> wrote:
> > > Please fix the MODULES case, perhaps by linking $(WIN32RES) into each library
> > > implicitly.

That idea was somewhat too broad.

> > Yes, that's exactly what I did in the patch attached by linking
> > WIN32RES and a shared library when the lib is built from a single .o
> > file. The rule in src/makefiles/Makefile.win32 has been updated
> > accordingly. pgxs.mk has been updated as well to remove WIN32RES when
> > clean is invoked for MODULES.
> 
> There remained several binaries versioned under MSVC and not versioned under
> MinGW.  With those fixed, I committed this work.

PostgreSQL 9.5 pgxs tries to link $(WIN32RES) into any single-file module, not
just in-tree modules.  Unless the module happens to ship a win32ver.rc file,
the build fails.  MODULE_big modules are unaffected.

I plan to fix this as attached, by linking $(WIN32RES) into single-file
modules only when PGFILEDESC is set in the Makefile.  That better aligns the
GNU make build system with the heuristic in the MSVC build system's
Project::AddDirResourceFile().  External modules wishing to embed a DLL icon
and/or version information should provide a win32ver.rc and set PGFILEDESC.
(As in released versions, MODULE_big modules must additionally mention
$(WIN32RES) in OBJS.)  Modules not desiring Windows file version information
should leave PGFILEDESC unset.  In-tree, installed modules do set PGFILEDESC;
to build one using PGXS, you can first build without PGXS and preserve the
generated win32ver.rc.

One alternative I considered was to link with $(WIN32RES) only when PGXS is
unset.  That would omit version information from in-tree, single-file modules
built with PGXS.  Unlike my plan, it would not break builds of modules that
set PGFILEDESC without intending to trigger inclusion of version information.
However, a grep of the code in PGXN found no affected module.

Thanks,
nm

-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs

Attachments:

pgxs-w32-single-file-v1.patch (text/plain, 1.6K) download diff --git a/src/makefiles/Makefile.win32 b/src/makefiles/Makefile.win32 index 176c8b9..fed1243 100644 --- a/src/makefiles/Makefile.win32 +++ b/src/makefiles/Makefile.win32 @@ -62,12 +62,18 @@ ifneq (,$(PGAPPICON)) PGICOSTR = $(subst /,\/,IDI_ICON ICON \"$(top_builddir)/src/port/$(PGAPPICON).ico\") endif +# We do not install src/port/win32ver.rc, its content being specific to +# PostgreSQL Global Development Group software. Any module can ship a +# win32ver.rc or furnish a rule for generating one. Set $(PGFILEDESC) to +# signal win32ver.rc availability to the dll build rule below. +ifndef PGXS win32ver.rc: $(top_srcdir)/src/port/win32ver.rc sed -e 's;FILEDESC;$(PGFILEDESC);' -e 's;VFT_APP;$(PGFTYPE);' -e 's;_ICO_;$(PGICOSTR);' -e 's;\(VERSION.*\),0 *$$;\1,'`date '+%y%j' | sed 's/^0*//'`';' $< >$@ +endif win32ver.o: win32ver.rc $(WINDRES) -i $< -o $@ --include-dir=$(top_builddir)/src/include --include-dir=$(srcdir) # Rule for building a shared library from a single .o file -%.dll: %.o $(WIN32RES) +%.dll: %.o $(if $(PGFILEDESC),$(WIN32RES)) $(CC) $(CFLAGS) -shared -static-libgcc -o $@ $^ -Wl,--export-all-symbols $(LDFLAGS) $(LDFLAGS_SL) $(BE_DLLLIBS) diff --git a/src/makefiles/pgxs.mk b/src/makefiles/pgxs.mk index b6874ce..2b4d684 100644 --- a/src/makefiles/pgxs.mk +++ b/src/makefiles/pgxs.mk @@ -202,7 +202,7 @@ endif # MODULE_big clean: ifdef MODULES - rm -f $(addsuffix $(DLSUFFIX), $(MODULES)) $(addsuffix .o, $(MODULES)) $(WIN32RES) + rm -f $(addsuffix $(DLSUFFIX), $(MODULES)) $(addsuffix .o, $(MODULES)) $(if $(PGFILEDESC),$(WIN32RES)) endif ifdef DATA_built rm -f $(DATA_built)

view thread (25+ messages)

Message-ID: <20150802025437.GA1661249@tornado.leadboat.com>
Permalink:  ../20150802025437.GA1661249@tornado.leadboat.com/
Also on:    postgresql.org/message-id/20150802025437.GA1661249@tornado.leadboat.com

 ·  · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: noah@leadboat.com, michael.paquier@gmail.com, maumau307@gmail.com, magnus@hagander.net
  Subject: Re: Missing file versions for a bunch of dll/exe files in Windows builds
  In-Reply-To: <20150802025437.GA1661249@tornado.leadboat.com>
  References: <CAB7nPqRtY1eikQGmz1_wbVHPvFyvE9VMA67ricepQ6D8-EgwnA@mail.gmail.com> <BA403D0A8188444F817198BDAB4F326F@maumau> <CAB7nPqTZy5j-Uts4xP=uNFMRVW=oBZAvyjGRGEMWjbDtaN_YZg@mail.gmail.com> <7E6471A0DAC54872AE6DFEB393554C77@maumau> <CAB7nPqQq-jdQdvaAAeO-ch9qmcA9+K0K9Ry1LTR-SjBA=2KkDA@mail.gmail.com> <20140710150244.GA1942769@tornado.leadboat.com> <CAB7nPqTozhMdCqXNsDeaBr30ofJpdt2P6u7v=FUA-_Z6tERD3w@mail.gmail.com> <20140711133439.GB1947575@tornado.leadboat.com> <CAB7nPqQ9D78y6qfXiNwYc92oT2YHK-i6GTkLaMadewzYUHPS9Q@mail.gmail.com> <20140714190328.GB2088773@tornado.leadboat.com> <20150802025437.GA1661249@tornado.leadboat.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox