Hi,
I was hacking in making aix work with the meson patchset last night when I
noticed this delightful bit:
gmake -C src/interfaces/libpq
...
rm -f libpq.a
ar crs libpq.a fe-auth-scram.o fe-connect.o fe-exec.o fe-lobj.o fe-misc.o fe-print.o fe-protocol3.o fe-secure.o
fe-trace.olegacy-pqsignal.o libpq-events.o pqexpbuffer.o fe-auth.o
touch libpq.a
( echo '#! libpq.so.5'; gawk '/^[^#]/ {printf "%s\n",$1}'
/home/andres/src/postgres/build-ac/../src/interfaces/libpq/exports.txt) >libpq.exp
gcc -maix64 -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Werror=vla -Wendif-labels
-Wmissing-format-attribute-Wimplicit-fallthrough=3 -Wformat-security -fno-strict-aliasing -fwrapv
-fexcess-precision=standard-Wno-format-truncation -O2 -pthread -D_REENTRANT -D_THREAD_SAFE -o libpq.so.5 libpq.a
-Wl,-bE:libpq.exp-L../../../src/port -L../../../src/common -lpgcommon_shlib -lpgport_shlib -Wl,-bbigtoc
-Wl,-blibpath:'/usr/local/pgsql/lib:/usr/lib:/lib' -Wl,-bnoentry -Wl,-H512 -Wl,-bM:SRE -lm
rm -f libpq.a
ar crs libpq.a libpq.so.5
we first create a static library libpq.a as normal, but then we overwrite it
with the special aix way of packing up shared libraries, by packing them up in
a static library. That part is correct, it's apparently the easiest way of
getting applications to link to shared libraries on AIX (I think the
-Wl,-bM:SRE is relevant for ensuring it'll be a dynamic link, rather than a
static one).
This likely has been going on for approximately forever.
Two questions:
1) Do we continue building static libraries for libpq etc?
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.
Greetings,
Andres Freund