Re: Build issue with postgresql 17 undefined reference to `pg_encoding_to_char' and `pg_char_to_encoding' - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Build issue with postgresql 17 undefined reference to `pg_encoding_to_char' and `pg_char_to_encoding'
Date
Msg-id 2656597.1728582542@sss.pgh.pa.us
Whole thread Raw
In response to Re: Build issue with postgresql 17 undefined reference to `pg_encoding_to_char' and `pg_char_to_encoding'  (Mikael Sand <msand@seaber.io>)
Responses Re: Build issue with postgresql 17 undefined reference to `pg_encoding_to_char' and `pg_char_to_encoding'
List pgsql-hackers
Mikael Sand <msand@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.

            regards, tom lane



pgsql-hackers by date:

Previous
From: Alvaro Herrera
Date:
Subject: Re: overflow bug for inhcounts
Next
From: Aleksander Alekseev
Date:
Subject: Re: Build issue with postgresql 17 undefined reference to `pg_encoding_to_char' and `pg_char_to_encoding'