Re: static libpq (and other libraries) overwritten on aix
Andres Freund <andres@anarazel.de>
From: Andres Freund <andres@anarazel.de>
To: Robert Haas <robertmhaas@gmail.com>
Cc: "pgsql-hackers@postgresql.org" <pgsql-hackers@postgresql.org>, Noah Misch <noah@leadboat.com>
Date: 2022-08-17T20:08:56Z
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@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
Commits
-
configure: Expand -fvisibility checks to more compilers, test for -qvisibility
- be7c15b194ab 16.0 landed
-
aix: No need to use mkldexport when we want to export all symbols
- fe6a64a58ab3 16.0 landed
-
aix: when building with gcc, tell gcc we're building a shared library
- e5484554ba90 16.0 landed
-
aix: Fix SHLIB_EXPORTS reference in VPATH builds
- 4444317f370c 16.0 landed
-
Remove SUBSYS.o rule in common.mk, hasn't been used in a long time
- 05bf551040ba 16.0 landed
-
Remove rule to generate postgres.o, not needed for 20+ years
- 68fc18d14c7e 16.0 landed
-
Make the AIX case of Makefile.shlib safe for parallel make.
- e8564ef03433 9.6.0 cited