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

From Mikael Sand
Subject Re: Build issue with postgresql 17 undefined reference to `pg_encoding_to_char' and `pg_char_to_encoding'
Date
Msg-id CAAwAxZeEEEANSKTna2xo85f7xG9UqzK+UX3AC9xxRuqwMJ5f7g@mail.gmail.com
Whole thread Raw
In response to Re: Build issue with postgresql 17 undefined reference to `pg_encoding_to_char' and `pg_char_to_encoding'  (Aleksander Alekseev <aleksander@timescale.com>)
List pgsql-hackers
E.g. this fails to compile:

FROM chainguard/git:latest-dev AS builder
USER root
RUN apk update && apk add --no-cache --update-cache clang-19 postgresql-17-dev openssl-dev
COPY <<EOF ./main.cpp
#include<libpq-fe.h>
int main(){return PQconnectdb("")==NULL;}
EOF
RUN clang++ -static -o main main.cpp -lpq -lpgcommon -lpgport -lssl -lcrypto

On Thu, Oct 10, 2024 at 12:16 PM Aleksander Alekseev <aleksander@timescale.com> wrote:
Hi Mikael,

Please use the "Reply to All" button - send your emails to the mailing
list, not to me directly.

> The official packages and the original source tar both fail to compile, the patch enables it to compile.

I just run:

```
docker run -e POSTGRES_PASSWORD=foo postgres:17.0-alpine3.20
```

... on my spare Raspberry Pi and it works just fine. Also PostgreSQL
is tested on Alpine [1].

It means that your custom Dockerfile is wrong. I suggest comparing it
with the one published on hub.docker.com [2]. Also I would recommend
reading the documentation section about compiling PostgreSQL from
source code [3]. I have a few scripts [4] that may help you correct
the Dockerfile as well [4].

All this of course assumes that you really want your custom Dockerfile
instead of using "official" / well regarded 17.0-alpine3.20 one.

[1]: https://buildfarm.postgresql.org/cgi-bin/show_status.pl
[2]: https://github.com/docker-library/postgres/blob/172544062d1031004b241e917f5f3f9dfebc0df5/17/alpine3.20/Dockerfile
[3]: https://www.postgresql.org/docs/current/installation.html
[4]: https://github.com/afiskon/pgscripts/

--
Best regards,
Aleksander Alekseev

pgsql-hackers by date:

Previous
From: Mikael Sand
Date:
Subject: Re: Build issue with postgresql 17 undefined reference to `pg_encoding_to_char' and `pg_char_to_encoding'
Next
From: Ebru Aydin Gol
Date:
Subject: Re: RFC: Additional Directory for Extensions