Hi All,
Recently I was debugging an issue in which builds of postgresql
succeeded on a developer's workstation, but failed in our company's
build system.
After some investigation, I found that the value of pkglibdir (as used
by src/Makefile.global and various other places) was different even
though the ./configure invocations were identical. Eventually, I found
that Makefile.global was the culprit, with some sections like:
pkglibdir = $(libdir)
ifeq "$(findstring pgsql, $(pkglibdir))" ""
ifeq "$(findstring postgres, $(pkglibdir))" ""
override pkglibdir := $(pkglibdir)/postgresql
endif
endif
On the developer's workstation, the sources had been unpacked in a
directory, e.g. (the structure is a quirk convention of an internal
tool)
$HOME/src/postgresql13-13.7/source
On the production build system, the path used was:
/build/source
The --prefix used is a subdirectory of the source directory (in this
context we're only building the source to get the static libpq and
headers, which we use to build another piece of software).
On the developer's workstation, the string "postgres" is part of the
path, and thus pkglibdir does not get "postgresql" appended via an
override (nor any of the other variables). But on the build system,
both tests pass, and the override with appended "postgresql" do occur.
I'm assuming that the intention of findstring postgres was to tidy up
values like pkglibdir when libdir is e.g. /usr/lib/postgres/, which
makes sense, but not when "postgres" appears in libdir for some other
reason.
We're able to patch around this, but I thought it might be worth
reporting. I considered devising a patch but haven't yet thought of a
good strategy, and I suspect it might be trick to avoid breaking other
users who may (even unwittingly) rely on this quirk. I would be
delighted to accept any suggestions however.
Thanks!
.andy