We use static linking and link time optimization to squeeze the last bits of performance out of the code in our most performance-critical queries, and it simplifies our security audits to have a static binary running inside chainguard/static as the data we handle is sensitive/business critical.
Wonderful, the build works when using -lpgcommon_shlib -lpgport_shlib So this appears to imply that the output of `pkg-config -libs -static libpq`is incorrect? /app # pkg-config -libs -static libpq > -L/usr/local/lib -lpq -L/usr/lib/llvm15/lib -L/usr/local/lib -lpgcommon > -lpgport -lgssapi_krb5 -lm -lldap -lssl -lcrypto -ldl -pthread > On Thu, Oct 10, 2024 at 7:54 PM Aleksander Alekseev < aleksan...@timescale.com> wrote: > Mikael, > > On Thu, Oct 10, 2024 at 8:49 PM Tom Lane <t...@sss.pgh.pa.us> wrote: > > > > Mikael Sand <ms...@seaber.io> writes: > > > RUN clang++ -fno-common -static -o main main.cpp \ > > > -L/usr/local/lib -lpq -lpgcommon -lpgport \ > > > -lldap -lsasl2 -lssl -lcrypto -llber \ > > > -lgssapi_krb5 \ > > > -lkrb5 -lk5crypto -lcom_err -lkrb5support \ > > > -lgdbm > > > > The short answer here is that your link recipe is wrong, and has been > > wrong right along, though you accidentally got away with it before. > > The modules within libpq expect to be linked with libpgcommon_shlib > > and libpgport_shlib, not libpgcommon/libpgport. > > > > Having external code that needs to know explicitly about every one > > of a library's dependencies is one of many reasons why we discourage > > static linking. > > May I ask what problem you are trying to solve with static linking in > the first place? > > -- > Best regards, > Aleksander Alekseev >