Re: static libpq (and other libraries) overwritten on aix - Mailing list pgsql-hackers

From Andres Freund
Subject Re: static libpq (and other libraries) overwritten on aix
Date
Msg-id 20220817200856.bn5z65iotzewkwnz@awork3.anarazel.de
Whole thread Raw
In response to Re: static libpq (and other libraries) overwritten on aix  (Robert Haas <robertmhaas@gmail.com>)
List pgsql-hackers
Hi,

On 2022-08-17 15:28:18 -0400, Robert Haas wrote:
> On Wed, Aug 17, 2022 at 3:02 PM Andres Freund <andres@anarazel.de> wrote:
> > 2) Do we care about static libraries not suriving on AIX? There could also be
> >    a race in the buildrules leading to sometimes static libs sometimes shared
> >    libs winning, I think.
>
> Instead of overwriting the same file, can we not use different
> filenames for different things?

Not easily, as far as I understand. The way one customarily links to shared
libraries on aix is to have an .a archive containing the shared library. That
way the -lpq picks up libpq.a, which then triggers the shared library to be
referenced.

E.g.
andres@gcc119:[/home/andres/src/postgres/build-ac]$ LIBPATH=$(pwd)/src/interfaces/libpq ldd src/bin/scripts/clusterdb
src/bin/scripts/clusterdb needs:
         /usr/lib/libc.a(shr_64.o)
         /usr/lib/libpthread.a(shr_xpg5_64.o)
         /usr/lib/libreadline.a(libreadline.so.6)
         /home/andres/src/postgres/build-ac/src/interfaces/libpq/libpq.a(libpq.so.5)
         /unix
         /usr/lib/libcrypt.a(shr_64.o)
         /usr/lib/libcurses.a(shr42_64.o)
         /usr/lib/libpthreads.a(shr_xpg5_64.o)

Note the .a(libpq.so.5) bit.


Unfortunately that's exactly how one links to a static library as well.

So we'd have to change the name used as -l$this between linking to a shared
libpq and a static libpq.

Greetings,

Andres Freund



pgsql-hackers by date:

Previous
From: Greg Stark
Date:
Subject: Re: shared-memory based stats collector - v70
Next
From: Marcos Pegoraro
Date:
Subject: Re: cataloguing NOT NULL constraints