Re: meson vs. llvm bitcode files

From: Andres Freund <andres(at)anarazel(dot)de>
To: Peter Eisentraut <peter(at)eisentraut(dot)org>
Cc: Nazir Bilal Yavuz <byavuz81(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: meson vs. llvm bitcode files
Date: 2026-04-01 13:19:34
Message-ID: 3whtmw6twe442o3r44gsagheq5cs2clcghzjeo7rljstpdemrh@oojczkhk2mbt
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

On 2026-03-31 09:43:11 +0200, Peter Eisentraut wrote:
> On 18.03.26 13:44, Nazir Bilal Yavuz wrote:
> > > The comment that introduces postgresql-extension-warnings.pc says
> > >
> > > +# Extension modules should likely also use -fwrapv etc. But it it's a
> > > bit odd
> > > +# to expose it to a .pc file?
> > >
> > > but then -fwrapv ends up in postgresql-extension.pc anyway. Not sure
> > > what was intended here.
> >
> > I asked Andres off-list and Andres said that we need to have these
> > flags inside the .pc file but it is not very nice since these flags
> > (-fwrapv for example) change the behavior. Maybe Andres could clarify
> > this better.
>
> Yes, it's probably right that extensions should build with the -f options
> that the server uses. You probably need -fwrapv and -fno-strict-aliasing at
> least. Then again, we don't know which compiler will consume the .pc file
> and whether it even supports these options in that particular spelling.

At the moment you can't really build server extensions against a postgres
built with a different compiler. E.g. building extensions with clang against a
server built with gcc triggers hundreds of warnings. We just do too many
detections at configure time to make that reliably work.

I don't think this is a meson specific problem...

> > > The Requires list in my case is for example
> > >
> > > Requires: krb5-gssapi, icu-uc, icu-i18n, ldap, libxml-2.0 >= 2.6.23,
> > > liblz4, openssl, zlib, libzstd >= 1.4.0
> > >
> > > but I don't think these are actually required for building extensions
> > > (unless a particular extension directly makes use of one of them, in
> > > which case they should declare that on their own).
> >
> > It seems that is how meson pkgconfig.generate() handles the
> > dependencies, please see [1]:
> >
> > ...
> > * Dependencies provided by pkg-config are added into Requires: or
> > Requires.private:. If a version was specified when declaring that
> > dependency it will be written into the generated file too.
> > ...
>
> Sure, but that doesn't make it right. ;-) It would be a quite a regression
> if extensions switched to using this .pc file (which we would want them to
> eventually), and then building an extension would require installing all
> these -dev packages.

I'm pretty confused - isn't what meson does the only reasonable thing? You
can't reliably build an extension without having all the dependencies that the
server was built against also installed, because we have headers that include
the dependencies. If you e.g. don't have openssl or kerberos installed any
[indirect ]include of libpq-be.h will fail.

I don't understand how this would be a regression.

And adding these dependencies to eitehr Requires or Requires.private seems
pretty much required to ever get static linking to work.

Greetings,

Andres Freund

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message jian he 2026-04-01 13:19:48 Re: More speedups for tuple deformation
Previous Message Mihail Nikalayeu 2026-04-01 13:18:15 Re: Online PostgreSQL version() updates