Re: peripatus build failures....

Tom Lane <tgl@sss.pgh.pa.us>

From: Tom Lane <tgl@sss.pgh.pa.us>
To: Larry Rosenman <ler@lerctr.org>
Cc: Thomas Munro <thomas.munro@enterprisedb.com>, Pg Hackers <pgsql-hackers@postgresql.org>
Date: 2018-07-07T18:47:10Z
Lists: pgsql-hackers
I wrote:
> Huh.  So what that suggests is that the problem is related to picking
> up copies of our libraries from outside the build tree.  Do you have
> any copies of libpgport.a/.so or libpgcommon.a/.so in
> /usr/local/lib or /usr/lib or /lib ?

Ah, no, scratch that, I see the problem.  In v10, peripatus builds
insert_username.so like this:

ccache clang -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -Wno-unused-command-line-argument -g -O2 -fPIC -DPIC -L../../src/port -L../../src/common -L/usr/local/lib -L/usr/local/lib -L/usr/lib  -Wl,--as-needed -Wl,-R'/home/pgbuildfarm/buildroot/REL_10_STABLE/inst/lib' -L../../src/port -lpgport  -shared -o insert_username.so insert_username.o

while v11 does it like this:

ccache clang -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -Wno-unused-command-line-argument -g -O2 -fPIC -DPIC -L../../src/port -L../../src/common -L/usr/local/lib -L/usr/local/lib -L/usr/lib  -Wl,--as-needed -Wl,-R'/home/pgbuildfarm/buildroot/REL_11_STABLE/inst/lib'  -shared -o insert_username.so insert_username.o

In the first case, we're trying to include code from libpgport.a directly
into the .so, and since libpgport.a isn't built with -fPIC, it blows up.
In the second case, we *don't* link libpgport.a here at all.  Rather,
any symbols that insert_username.so needs from that library will be
resolved in the main backend's copy of the library, for which
relocatability isn't required.

Note that there's a second problem with the way this is happening pre-v11:
for any src/port/ file that compiles different logic for frontend and
backend, insert_username.so would be picking up the wrong logic.  Perhaps
we've not noticed because that module doesn't use any files in which
there's a meaningful difference, but there's an obvious hazard there.
Fooling with -fPIC isn't enough to fix it.

I'd been hesitant to back-patch dddfc4cb2 back in April; but now that
it's survived some beta testing, I think that doing so seems like the
most appropriate way to fix this.

			regards, tom lane


Commits

Same data as JSON: GET /api/v1/messages/:b64id/commits the thread's linked commits as JSON, with link sources. API reference →
  1. Prevent accidental linking of system-supplied copies of libpq.so etc.

  2. Fix partial-build problems introduced by having more generated headers.

  3. Fix the new ARMv8 CRC code for short and unaligned input.

  4. Use ARMv8 CRC instructions where available.

  5. Fix incorrect description of USE_SLICING_BY_8_CRC32C.

  6. Add an assertion that we don't pass NULL to snprintf("%s").

  7. Update copyright for 2018