From: | Christoph Berg <myon(at)debian(dot)org> |
---|---|
To: | Jacob Champion <jacob(dot)champion(at)enterprisedb(dot)com> |
Cc: | PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Wolfgang Walther <walther(at)technowledgy(dot)de>, Timo Röhling <roehling(at)debian(dot)org> |
Subject: | Re: libcurl in libpq.pc |
Date: | 2025-09-23 14:00:50 |
Message-ID: | aNKoEpdrJJQeHYRX@msg.df7cb.de |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Re: Jacob Champion
> > > Since nothing in libpq should need curl for compiling, should we drop
> > > it there instead?
> >
> > The static build (libpq.a) still needs libcurl. The module is only
> > compiled for use by the shared library.
>
> Sorry, typing too fast in the airport. The _clients_ of libpq.a still
> need libcurl, after they link libpq-oauth.a for the missing symbols.
> Isn't that what Requires.private is for?
Sorry for not following up here earlier. I've just uploaded 18rc1 to
Debian unstable to pave the way for the 18.0 release, and this
regression in "hoel" popped up again.
It turns out that pkg-config is picky when it doesn't find the .pc
files listed in Requires.private. So, without libcurl4-openssl-dev
installed:
Libs handling is ok:
$ pkgconf --libs libpq
-lpq
But CFLAGS is not:
$ pkgconf --cflags libpq
Package libcurl was not found in the pkg-config search path.
Perhaps you should add the directory containing `libcurl.pc'
to the PKG_CONFIG_PATH environment variable
Package 'libcurl', required by 'libpq', not found
This "we don't care about the difference between static and dynamic in
CFLAGS" part of pkg-confg is actually a FAQ item:
3. My library z uses libx internally, but does not expose libx data
types in its public API. What do I put in my z.pc file?
Again, add the module to Requires.private if it supports pkg-config.
In this case, the compiler flags will be emitted unnecessarily, but
it ensures that the linker flags will be present when linking
statically. If libx does not support pkg-config, add the necessary
linker flags to Libs.private.
https://people.freedesktop.org/~dbn/pkg-config-guide.html#faq
Since most libpq users are linking dynamically (and certainly
everything in Debian), I will now patch libpq.pc to drop libcurl from
Requires.private and add -lcurl to Libs.private.
That way, users trying to link statically will get a meaningful
"libcurl not found" message instead of randomly missing symbols.
I would say this change should make it into 18.1's libpq.pc file.
Thanks to Timo Röhling for helping me understand this issue.
Christoph
From | Date | Subject | |
---|---|---|---|
Next Message | Christoph Berg | 2025-09-23 14:16:19 | Re: libcurl in libpq.pc |
Previous Message | Ashutosh Sharma | 2025-09-23 13:10:52 | Re: Clear logical slot's 'synced' flag on promotion of standby |