Re: static libpq (and other libraries) overwritten on aix

From: Andres Freund <andres(at)anarazel(dot)de>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>, Noah Misch <noah(at)leadboat(dot)com>
Subject: Re: static libpq (and other libraries) overwritten on aix
Date: 2022-08-17 20:08:56
Message-ID: 20220817200856.bn5z65iotzewkwnz@awork3.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)anarazel(dot)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(at)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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Marcos Pegoraro 2022-08-17 20:09:22 Re: cataloguing NOT NULL constraints
Previous Message Greg Stark 2022-08-17 19:46:42 Re: shared-memory based stats collector - v70