Re: meson's in-tree libpq header search order vs -Dextra_include_dirs

Andres Freund <andres@anarazel.de>

From: Andres Freund <andres@anarazel.de>
To: Thomas Munro <thomas.munro@gmail.com>
Cc: Tom Lane <tgl@sss.pgh.pa.us>, Tristan Partin <tristan@partin.io>, pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2025-11-04T19:55:56Z
Lists: pgsql-hackers

Commits

Same data as JSON: GET /api/v1/messages/:b64id/commits the thread's linked commits as JSON, with link sources. API reference →
  1. ci: Add missing "set -e" to scripts run by su.

  2. Don't put library-supplied -L/-I switches before user-supplied ones.

Attachments

Hi,

On 2025-11-04 18:30:51 +1300, Thomas Munro wrote:
> First two patches as before, except for a couple of unnecessary hunks
> I deleted based on an off-list review from Bilal.

I think there may be a less verbose way to do this:

The problem is caused by us adding extra_include_dirs to postgres_inc_d, which
does not include the private include dir for e.g. libpq. As it is added to
frontend_code etc as a flat list, there's no way for meson to know that
src/interfaces/libpq should be added earlier in the commandline.

The position we add extra_include_dirs right now also seems wrong on windows,
leaving libpq aside, as it's added *before* src/include/port/win32 etc.


The easiest way to fix that seems to be to simply not extra_include_dirs to
postgres_inc_d, but instead either add it to cppflags (the meson variable, not
the environment) or add it to the project C flags.

It seems that with autoconf we add the --with-includes to the pg_config
--cppflags, but we don't today with meson. Adding it to the cppflags variable
would take care of that too.

A quick prototype of that is attached.

Thoughts?

Greetings,

Andres Freund