Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1wkTbu-000hM3-2a for pgsql-hackers@arkaria.postgresql.org; Thu, 16 Jul 2026 21:27:15 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wkTbt-00F77V-1Z for pgsql-hackers@arkaria.postgresql.org; Thu, 16 Jul 2026 21:27:13 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1wkTbs-00F77M-1Q for pgsql-hackers@lists.postgresql.org; Thu, 16 Jul 2026 21:27:13 +0000 Received: from fhigh-b2-smtp.messagingengine.com ([202.12.124.153]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1wkTbo-00000000eyE-3n5P for pgsql-hackers@lists.postgresql.org; Thu, 16 Jul 2026 21:27:12 +0000 Received: from phl-compute-04.internal (phl-compute-04.internal [10.202.2.44]) by mailfhigh.stl.internal (Postfix) with ESMTP id D41977A001E; Thu, 16 Jul 2026 17:27:05 -0400 (EDT) Received: from phl-frontend-03 ([10.202.2.162]) by phl-compute-04.internal (MEProxy); Thu, 16 Jul 2026 17:27:05 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=anarazel.de; h= cc:cc:content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:subject :subject:to:to; s=fm2; t=1784237225; x=1784323625; bh=Nw5sw92W91 unIFC1X1y/QHca/0OvUm3R1dIyX6TajXk=; b=YMhIsQJBjfuGIULycDHKP3QMxi kcjuntyTYK1/M+agE+UtwMzdI+av6lTbVOLYHpE8YjdtDEXnySsz2qjOz6wVRUj9 2A30WMeYsppVa6LwyT6ZyjMSnDXsyOuj4P/CO8OkDmbi8QyOPzQ9gsIqAdE14yBw 7P74MqNuc7j8t+BJZ+uRBfrjc0ctp0CsQOvlPVJabc3I/hro2RinqXRvACQztxDQ 1Ga8Q06tUht2AX9rAZo07tiJx/C6p9tJVBR0dOYMKN2GOJrBx8rRfLgw1/jhgbwi iafIJbiSthCnVF/aH7TtTnleZ0vDFmfe1LYjnENtfmoDtcZmxYoU4ECqEZtQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t= 1784237225; x=1784323625; bh=Nw5sw92W91unIFC1X1y/QHca/0OvUm3R1dI yX6TajXk=; b=g3N2T97YA7Bjkh08pPH22XQ4KPDVsXqtOflKL/TxwLKK8ieCyk9 GggYSmmoHzkm86PqbRYTcyHiLPG3UzPUdS0poBWlnV3m1oE0K8JY2NATVRbeYipb ZrsZ6fW3D/tn1RsFMti6fRCtmNHMGe4C+e5pZ7y14j9ppB6TKYh8LVowDGX0lBOB u93hFgHM6SV7gGJ5qbxmNNpJeU03AUZxku3PseBzNp7gtt25Ofys9gje7O0uRbO8 ipXItaFB+fwFh2aRe9nLbBGtlkdPHp5tafgsEgkUQkHQW9Nm5jDSA05H07zLllDD iU1LAXovfvWimHEGujawO0Cjq4v7bEaXNqQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: dmFkZTE0JjxTCNN8oUlF9Ma8dpVSlz1v3DMzMXmjfgLOWRsc49bAjpyQRQ0shEBatAM+IO zJ26twKM+uHD6mCuGsOoS0wwn51t1n4B191EYIQOcGQDb+/fhArM4dgen+Agz1NcCTA0BN wBN/4WM+UYp2KolXMA3g1+jj4//H6yn7iP3mfzfQjbVKrkFo5iVy+7gFX5eNJfHcy8p8Qd aQG15HalscVXrv4F2cUkQBmCjQMaqgahmn9Vxha7DcCE0ne3j9KnAg/ps0ovsGzSqjhsqy El3o58h8mPXxtv1D6JQZxzWYtggHiQmhe54aylF0IqKWdMos8ZpyB/d3fdHNZw5YrqVINh +Ix9sbiottevMwoCYoX5izdL1GYCu744wupfq7oW3MI2hIa0LQBxqQsOVX3teQvERD8Wku Tkd7G+savk1SJ4bT8cXSuxd8ZY4rOnLNltmwFkJNeQB78HXasviiWdr0XnCV9VSA7xnAtY jER66MXBJA5PitxeiZe9J2Gz4F9o6Nae0sdLhRMKtiB5cZ9SvHRlFQUqo5Jr59xke63K24 ccOsVfBAnbSRmf2X+7D9PrDtvmrCJ2XSqWZc6wusiqNr3v5wPBWSL3oeScH917bjlVYkpO unaZjGG+N9FjhezK4rD6uYLZBKkTZgyVLE5T/ahp7IJDsGwqB3iPC7h27E+Q X-ME-Proxy: Feedback-ID: id4a34324:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 16 Jul 2026 17:27:05 -0400 (EDT) Date: Thu, 16 Jul 2026 17:27:04 -0400 From: Andres Freund To: Peter Eisentraut Cc: Nazir Bilal Yavuz , PostgreSQL Hackers Subject: Re: ci: namespace ccache by PostgreSQL major version Message-ID: References: <71837b73-768c-4f58-b799-a4462ef0e102@eisentraut.org> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="lrkjybh77g2jf2vx" Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --lrkjybh77g2jf2vx Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Hi, On 2026-07-07 13:35:34 -0400, Andres Freund wrote: > On 2026-07-06 09:52:19 +0200, Peter Eisentraut wrote: > > On 03.07.26 16:26, Nazir Bilal Yavuz wrote: > > > Hi, > > > > > > When the Postgres major version is updated, CI fails with [1]: > > > > > > 2026-07-02 17:01:01.938 UTC [828] FATAL: incompatible library > > > "D:/a/postgresql/postgresql/build/tmp_install/usr/local/pgsql/lib/utf8_and_win.dll": > > > version mismatch > > > 2026-07-02 17:01:01.938 UTC [828] DETAIL: Server is version 20, > > > library is version 19. > > > > > > This happens because the GitHub Actions ccache is restored across a > > > version bump, so objects built against the previous version can be > > > reused, producing libraries that no longer match the server version. > > > > > > Here is an attempt to solve this problem by namespacing ccache by > > > Postgres major version. I added a 'PG_MAJOR_VERSION' variable to the > > > CI file and used that as a prefix to ccache key. I made this > > > 'PG_MAJOR_VERSION' variable automatically updated by > > > 'version_stamp.pl' script. > > > > > > Another solution could be reading the version from build files (e.g > > > meson.build), but then this read needs to be done at each CI run. > > > > I'm suspicious about this direction. The major version is not the only > > piece of data that determines ABI compatibility between the server and > > extensions. This would only be a partial information. The ABI information > > exists in the code, and so changes should be visible to ccache. Maybe we > > are using ccache in the wrong mode or something (see "depend mode", "direct > > mode", etc.). > > Yea, I don't think that's the right answer. I'm reasonably sure I debugged > this issue a while ago: > > https://postgr.es/m/phsrssp75npoyalqsolcd7fmnmlbzbmquc2p7w7mqjlw7432jk%40bzskz3luyjvb > > Not a lot has happened on the ccache front, so I suspect we should start > adding the -fpch-deps flag I mentioned in that thread. > > We could make adding -fpch-deps conditional on pch support being enabled, but > given that it doesn't do anything when pch is not used, I'd just add it when > supported by the compiler. Attached is the change I propose. Greetings, Andres --lrkjybh77g2jf2vx Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v2-0001-meson-Fix-ccache-issues-when-using-precompiled-he.patch" From 77df912a3172bbd3ea672708469d02ca938f79ee Mon Sep 17 00:00:00 2001 From: Andres Freund Date: Wed, 15 Jul 2026 15:27:16 -0400 Subject: [PATCH v2] 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. 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 --- meson.build | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/meson.build b/meson.build index 61b5681851e..f4cde249242 100644 --- a/meson.build +++ b/meson.build @@ -2185,6 +2185,12 @@ common_functional_flags = [ # Disable optimizations that assume no overflow; needed for gcc 4.3+ '-fwrapv', '-fexcess-precision=standard', + # Without -fpch-deps gcc emits dependencies that are insufficient for ccache + # to trigger a rebuild when the precompiled header changes. We could make + # this depend on using gcc and precompiled headers being enabled, but that's + # probably not worth it. See also + # https://github.com/ccache/ccache/issues/1686 + '-fpch-deps', ] cflags += cc.get_supported_arguments(common_functional_flags) -- 2.54.0.450.g9ac3f193c0 --lrkjybh77g2jf2vx--