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

From: Thomas Munro <thomas(dot)munro(at)gmail(dot)com>
To: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: meson's in-tree libpq header search order vs -Dextra_include_dirs
Date: 2025-02-03 00:28:40
Message-ID: CA+hUKGKispvxLyrBn3=3mp0BB1N+RBYR5eE2guCOksnwEoOcPQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

When I use configure/make and --with-includes=/usr/local/include, I
see compile lines like this:

... -I../../src/interfaces/libpq -I../../src/include -I/usr/local/include ...

That's important, because if I happen to have libpq headers installed
on the system I don't want to be confused by them. Yet meson's
-Dextra_include_dirs=/usr/local/include compiles like this:

... -I../src/include -I/usr/local/include -Isrc/interfaces/libpq ...

... which gives me errors due to the v16 headers I happen to have installed:

../src/fe_utils/connect_utils.c:164:3: error: unknown type name
'PGcancelConn'; did you mean 'PGcancel'?
164 | PGcancelConn *cancelConn = PQcancelCreate(conn);

I guess this affects Macs, BSDs and a few lesser used Linux distros
that put optional packages outside the base system and default search
paths. Perhaps you can see this on everything-goes-into-base-system
distros if you redundantly say -Dextra_include_dirs=/usr/include; I
didn't check if that is true, it wouldn't be if meson is opinionated
enough to remove it.

Reordering obvious mentions of libpq, as in the attached, gets past
most of them but I couldn't immediately figure out how to reorder
src/test/isolation/meson.build and gave up and uninstalled the
interfering libpq package for now. Dumping these observations here as
this is as far as I got with this impediment today.

Attachment Content-Type Size
wip-reorder-include.diff application/octet-stream 3.3 KB

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2025-02-03 00:29:17 Re: Proposal to CREATE FOREIGN TABLE LIKE
Previous Message Michael Paquier 2025-02-02 23:59:55 Re: Issues with 2PC at recovery: CLOG lookups and GlobalTransactionData