Re: Regression tests fail with musl libc because libpq.so can't be loaded

From: Wolfgang Walther <walther(at)technowledgy(dot)de>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: PostgreSQL Bugs <pgsql-bugs(at)lists(dot)postgresql(dot)org>
Subject: Re: Regression tests fail with musl libc because libpq.so can't be loaded
Date: 2024-03-16 15:55:49
Message-ID: 443da167-ee01-47d2-9c83-105694b4cbd5@technowledgy.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers

Tom Lane:
> Why do you think this is our bug and not musl's?

Because I tried to reproduce with musl directly with a very simple
example as mentioned in:

> To rule out a musl bug, I also put together a very simple test-case of an executable loading liba with dlopen(), which depends on libb and then constructing the same scenario with LD_LIBRARY_PATH. This works fine when compiled with glibc and musl, too. Thus, I believe the problem to be somewhere in how postgres loads those libraries.

My test case looked like the attached. To compile it with musl via
Dockerfile:

docker build . -t musl-dlopen && docker run --rm musl-dlopen

a.c/a.h is equivalent to libpqwalreceiver and b.c/b.h to libpq.

This works fine with both musl and glibc.

(Note: I also tried putting liba.so and libb.so in different folders,
adding both to LD_LIBRARY_PATH - but that worked fine as well.)

Now my very simple example probably does something different than
postgres, so that the problem doesn't appear there. But since it seems
possible to do this with musl in principle, it should be possible to do
it differently in postgres to make it work, too.

Any ideas?

Best,
Wolfgang

Attachment Content-Type Size
a.c text/x-csrc 85 bytes
a.h text/x-chdr 10 bytes
b.c text/x-csrc 63 bytes
b.h text/x-chdr 10 bytes
Dockerfile text/plain 132 bytes
main.c text/x-csrc 319 bytes
test.sh application/x-shellscript 199 bytes

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Rahul Uniyal 2024-03-16 17:55:49 Postgres jdbc driver inconsistent behaviour with double precession
Previous Message feichanghong 2024-03-16 14:29:03 ReplicationSlotRelease may set the statusFlags of other processes in PG14

Browse pgsql-hackers by date

  From Date Subject
Next Message vignesh C 2024-03-16 17:08:30 Re: speed up a logical replica setup
Previous Message Euler Taveira 2024-03-16 15:46:07 Re: speed up a logical replica setup