Re: Build issue with postgresql 17 undefined reference to `pg_encoding_to_char' and `pg_char_to_encoding'

2024-10-10 Thread Mikael Sand
if it is possible? regards, mikael sand On Fri, Oct 11, 2024 at 12:12 AM Tom Lane wrote: > Mikael Sand writes: > > I wonder if it would be possible to link pgcommon_shlib and pgport_shlib > > statically into pq and do LTO already at that point, such that consumers > of >

Re: Build issue with postgresql 17 undefined reference to `pg_encoding_to_char' and `pg_char_to_encoding'

2024-10-10 Thread Mikael Sand
B and pre-computing them as far as possible without authorization information. We've planned further profiling and optimization of data access and physical layout. No locks should affect this specific use case. On Thu, Oct 10, 2024 at 11:07 PM Mikael Sand wrote: > One question, > > I

Re: Build issue with postgresql 17 undefined reference to `pg_encoding_to_char' and `pg_char_to_encoding'

2024-10-10 Thread Mikael Sand
ublic distribution and haven't needed this kind of functionality, but perhaps someone on the mailing list would already have the necessary expertise? Br Mikael On Thu, Oct 10, 2024 at 10:33 PM Mikael Sand wrote: > Btw Aleksander > > To give some context, this is a component intende

Re: Build issue with postgresql 17 undefined reference to `pg_encoding_to_char' and `pg_char_to_encoding'

2024-10-10 Thread Mikael Sand
rk in a read replica would further improve performance significantly, so as not to send the large amount of data from the database to the backend, but this will be a later project. I can have measurements regarding static + lto vs dynamic before that. Br Mikael On Thu, Oct 10, 2024 at 10:22 PM M

Re: Build issue with postgresql 17 undefined reference to `pg_encoding_to_char' and `pg_char_to_encoding'

2024-10-10 Thread Mikael Sand
Hi Aleksander Ok. So no actual benefit from using dynamic? Well, it seems postgresql and all dependencies already support it, no? Doesn't go do static linking by default / prefer it? Unless you use some part that uses CGO, in which case many go developers appear to disable CGO anyway and use the p

Re: Build issue with postgresql 17 undefined reference to `pg_encoding_to_char' and `pg_char_to_encoding'

2024-10-10 Thread Mikael Sand
r)/%,$(filter -L%,$(LDFLAGS) $(SHLIB_LINK $(filter-out $(PKG_CONFIG_REQUIRES_PRIVATE:lib%=-l%),$(filter -l%,$(SHLIB_LINK_INTERNAL) $(SHLIB_LINK)))' >>$@ ## Br Mikael On Thu, Oct 10, 2024 at 9:08 PM Mikael Sand wrote: > Aleksander, do you have something against static linking or a

Re: Build issue with postgresql 17 undefined reference to `pg_encoding_to_char' and `pg_char_to_encoding'

2024-10-10 Thread Mikael Sand
t 10, 2024 at 8:29 PM Mikael Sand wrote: > Just for reference in case anyone else who utilizes static linking for any > reason hits upon this issue, here is a working Dockerfile for libpq / > postgresql 17 > > FROM postgres:17.0-alpine3.20 AS builder > USER root > WORKDIR /app &

Re: Build issue with postgresql 17 undefined reference to `pg_encoding_to_char' and `pg_char_to_encoding'

2024-10-10 Thread Mikael Sand
Just for reference in case anyone else who utilizes static linking for any reason hits upon this issue, here is a working Dockerfile for libpq / postgresql 17 FROM postgres:17.0-alpine3.20 AS builder USER root WORKDIR /app RUN apk update && apk add --no-cache --update-cache \ openssl-libs-stat

Re: Build issue with postgresql 17 undefined reference to `pg_encoding_to_char' and `pg_char_to_encoding'

2024-10-10 Thread Mikael Sand
b5 -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 wrote: > > > > Mikael Sand writes: > > > RUN clang++ -fno-common -sta

Re: Annoying build warnings from latest Apple toolchain

2024-10-10 Thread Mikael Sand
-lsasl2 -lssl -lcrypto -llber \ -lgssapi_krb5 \ -lkrb5 -lk5crypto -lcom_err -lkrb5support \ -lgdbm Best regards Mikael Sand

Re: Build issue with postgresql 17 undefined reference to `pg_encoding_to_char' and `pg_char_to_encoding'

2024-10-10 Thread Mikael Sand
r.gz && cd cyrus-sasl-2.1.28 && ./configure --enable-static && make && make install RUN clang++ -fno-common -static -o main main.cpp \ -L/usr/local/lib -lpq -lpgcommon -lpgport \ -lldap -lsasl2 -lssl -lcrypto -llber \ -lgssapi_krb5 \ -lkrb5 -lk5crypt

Re: Build issue with postgresql 17 undefined reference to `pg_encoding_to_char' and `pg_char_to_encoding'

2024-10-10 Thread Mikael Sand
ake? I must say I don't fully comprehend the context of that commit. On Thu, Oct 10, 2024 at 5:06 PM Mikael Sand wrote: > This seems to be the commit that caused this: > https://github.com/postgres/postgres/commit/b6c7cfac88c47a9194d76f3d074129da3c46545a > > So it seems the com

Re: Build issue with postgresql 17 undefined reference to `pg_encoding_to_char' and `pg_char_to_encoding'

2024-10-10 Thread Mikael Sand
This seems to be the commit that caused this: https://github.com/postgres/postgres/commit/b6c7cfac88c47a9194d76f3d074129da3c46545a So it seems the commit is related to static linking. Is it somehow possible to statically link in a version of pgcommon with correct function names into libpq?

Re: Build issue with postgresql 17 undefined reference to `pg_encoding_to_char' and `pg_char_to_encoding'

2024-10-10 Thread Mikael Sand
Hmm, so is static linking of all applications that include libpq intentionally broken? At least googling around, it seems like a relatively common practice. At least it seems that 2ndquadrant builds and uses libpq statically. https://www.postgresql.org/message-id/20327.1501536978%40sss.pgh.pa.us

Re: Build issue with postgresql 17 undefined reference to `pg_encoding_to_char' and `pg_char_to_encoding'

2024-10-10 Thread Mikael Sand
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 < int main(){return PQconnectdb("")==NULL;} EOF RUN clang++ -static -o main main.cpp -lpq -lpgcommon -lpgport -lssl -lcryp

Re: Build issue with postgresql 17 undefined reference to `pg_encoding_to_char' and `pg_char_to_encoding'

2024-10-10 Thread Mikael Sand
Hello Aleksander This is for compiling a c++ application that uses libpq with the -static flag, the server compiles fine. Br Mikael On Thu, Oct 10, 2024 at 12:16 PM Aleksander Alekseev < aleksan...@timescale.com> wrote: > Hi Mikael, > > Please use the "Reply to All" button - send your emails to

Re: Build issue with postgresql 17 undefined reference to `pg_encoding_to_char' and `pg_char_to_encoding'

2024-10-10 Thread Mikael Sand
Sorry for not having a properly minimal reproduction to begin with, seems I can't reduce this any further at the moment at least: # syntax=docker/dockerfile:1 > FROM chainguard/git:latest-dev AS builder > USER root > WORKDIR /app > RUN apk update && apk add --no-cache --update-cache \ > clang-

Re: Build issue with postgresql 17 undefined reference to `pg_encoding_to_char' and `pg_char_to_encoding'

2024-10-10 Thread Mikael Sand
lt; signals.size(); ++i) { > struct sigaction action; > memset(&action, 0, sizeof action); > action.sa_flags = static_cast(SA_SIGINFO | SA_ONSTACK | SA_NODEFER | > SA_RESETHAND); > sigfillset(&action.sa_mask); > sigdelset(&action.sa_mask, signals[i])

Re: Build issue with postgresql 17 undefined reference to `pg_encoding_to_char' and `pg_char_to_encoding'

2024-10-10 Thread Mikael Sand
} EOF # Fails with "-static" succeeds without RUN CC=clang CXX=clang++ clang++ \ -std=c++20 \ -static \ -flto \ -O3 \ -march=native \ -Wpedantic \ -Wall \ -Wextra \ -Wsign-conversion \ -Wconversion \ -o main main.cpp \ -lpq \ -lpgcommon \

Build issue with postgresql 17 undefined reference to `pg_encoding_to_char' and `pg_char_to_encoding'

2024-10-10 Thread Mikael Sand
gcommon -lpgport -lssl -lcrypto -lpthread -ldl ERROR 1.0s 1 /usr/bin/ld: /usr/local/lib/libpq.a(fe-connect.o): in function `pqConnectOptions2': 2 fe-connect.c:(.text+0x1cb4): undefined reference to `pg_encoding_to_char' 3 /usr/bin/ld: /usr/local/lib/libpq.a(fe-connect.o): in function `PQsetClientEncoding': 4 fe-connect.c:(.text+0x64a8): undefined reference to `pg_encoding_to_char' 5 /usr/bin/ld: /usr/local/lib/libpq.a(fe-exec.o): in function `pqSaveParameterStatus': 6 fe-exec.c:(.text+0x1168): undefined reference to `pg_char_to_encoding' 7 /usr/bin/ld: /usr/local/lib/libpq.a(fe-misc.o): in function `PQenv2encoding': 8 fe-misc.c:(.text+0x1394): undefined reference to `pg_char_to_encoding' 9 clang++: error: linker command failed with exit code 1 (use -v to see invocation) Any ideas? Best regard Mikael Sand Dockerfile Description: Binary data