pgsql: meson: Fix ccache issues when using precompiled headers with gcc

From: Andres Freund <andres(at)anarazel(dot)de>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: meson: Fix ccache issues when using precompiled headers with gcc
Date: 2026-07-17 15:27:37
Message-ID: E1wkkTQ-000dmd-2S@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

meson: Fix ccache issues when using precompiled headers with gcc

Unfortunately the combination of gcc, precompiled headers, ccache and meson
currently is not safe without further options. The dependencies emitted by gcc
are insufficient to trigger rebuilds when headers "below" the precompiled
headers are changed. Whether that's a ccache, gcc or meson bug is
debatable. Luckily gcc's -fpch-deps option fixes the issue.

This problem occasionally leads to build failures, e.g. if only c.h,
postgres.h or pg_config_manual.h change. That's e.g. the case when creating a
new major version branch.

Reviewed-by: Nazir Bilal Yavuz <byavuz81(at)gmail(dot)com>
Reviewed-by: Jelte Fennema-Nio <postgres(at)jeltef(dot)nl>
Discussion: https://postgr.es/m/CAN55FZ0tqR6Xz%3DiVFLc1BBoLOEHU775ARhcGYwggHA3XLA%3DoQg%40mail.gmail.com
Discussion: https://postgr.es/m/CA+hUKG+s7Yvt0PUnSQUEjCjysV-7-51n9B1h468Le3VJi0x4ZQ@mail.gmail.com
Discussion: https://postgr.es/m/phsrssp75npoyalqsolcd7fmnmlbzbmquc2p7w7mqjlw7432jk@bzskz3luyjvb
Discussion: https://github.com/ccache/ccache/issues/1686
Backpatch-through: 16, where meson support was added

Branch
------
REL_18_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/125893ce83b8218db8446f5f6f416cdbf9e80f7b

Modified Files
--------------
meson.build | 6 ++++++
1 file changed, 6 insertions(+)

Browse pgsql-committers by date

  From Date Subject
Next Message Andres Freund 2026-07-17 16:19:30 pgsql: ci: Use optimized build for mingw
Previous Message Peter Eisentraut 2026-07-17 14:09:20 Re: pgsql: SQL Property Graph Queries (SQL/PGQ)