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.98.2) (envelope-from ) id 1xBwBB-00000003Syj-0rwr for pgsql-bugs@arkaria.postgresql.org; Wed, 30 Sep 2026 15:25:09 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.98.2) (envelope-from ) id 1xBwBA-000000032Wy-0sX8 for pgsql-bugs@arkaria.postgresql.org; Wed, 30 Sep 2026 15:25:08 +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.98.2) (envelope-from ) id 1xBwB9-000000032Wp-42W4 for pgsql-bugs@lists.postgresql.org; Wed, 30 Sep 2026 15:25:07 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1xBwB7-000000027b9-1gVf for pgsql-bugs@lists.postgresql.org; Wed, 30 Sep 2026 15:25:07 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.18.1/8.18.1) with ESMTP id 68UFOunD859826; Wed, 30 Sep 2026 11:24:57 -0400 From: Tom Lane To: Ross Burton cc: pgsql-bugs@lists.postgresql.org Subject: Re: BUG #19727: pg-combinebackup fails to link In-reply-to: <769387.1790775367@sss.pgh.pa.us> References: <19727-32d67d9dea410f38@postgresql.org> <599939.1790693300@sss.pgh.pa.us> <682272.1790695839@sss.pgh.pa.us> <769387.1790775367@sss.pgh.pa.us> Comments: In-reply-to Tom Lane message dated "Wed, 30 Sep 2026 09:36:07 -0400" MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----- =_aaaaaaaaaa0" Content-ID: <859788.1790781865.0@sss.pgh.pa.us> Date: Wed, 30 Sep 2026 11:24:56 -0400 Message-ID: <859825.1790781896@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk ------- =_aaaaaaaaaa0 Content-Type: text/plain; charset="us-ascii" Content-ID: <859788.1790781865.1@sss.pgh.pa.us> I wrote: > Ross Burton writes: >> This is a makefile dependency bug exposed in parallel builds, and can >> be reproduced on demand with a minimal reproducer. > Very interesting! So the problem is that the scope of the effects of > this: > jsonapi_shlib.o: override CPPFLAGS += -DJSONAPI_USE_PQEXPBUFFER > isn't terribly well-defined. I dug in the gmake manual and verified that they document this behavior and point out that it can produce inconsistent results. So we need to fix it. The attached seems to do the trick, but now I wonder where else there might be similar issues. I did a few rounds of "make -s -j32 --shuffle" and didn't see any other compilation failures, but that isn't a very thorough test. regards, tom lane ------- =_aaaaaaaaaa0 Content-Type: text/x-diff; name="v1-fix-makefile-variable-usage.patch"; charset="us-ascii" Content-ID: <859788.1790781865.2@sss.pgh.pa.us> Content-Description: v1-fix-makefile-variable-usage.patch Content-Transfer-Encoding: quoted-printable diff --git a/src/common/Makefile b/src/common/Makefile index 3404601b6bf..daeba105af9 100644 --- a/src/common/Makefile +++ b/src/common/Makefile @@ -162,11 +162,6 @@ libpgcommon_shlib.a: $(OBJS_SHLIB) rm -f $@ $(AR) $(AROPT) $@ $^ = -# The JSON API normally exits on out-of-memory; disable that behavior for= shared -# library builds. This requires libpq's pqexpbuffer.h. -jsonapi_shlib.o: override CPPFLAGS +=3D -DJSONAPI_USE_PQEXPBUFFER -jsonapi_shlib.o: override CPPFLAGS :=3D -I$(libpq_srcdir) $(CPPFLAGS) - # Because this uses its own compilation rule, it doesn't use the # dependency tracking logic from Makefile.global. To make sure that # dependency tracking works anyway for the *_shlib.o files, depend on @@ -176,6 +171,12 @@ jsonapi_shlib.o: override CPPFLAGS :=3D -I$(libpq_src= dir) $(CPPFLAGS) %_shlib.o: %.c %.o $(CC) $(CFLAGS) $(CFLAGS_SL) $(CPPFLAGS) -c $< -o $@ = +# The JSON API normally exits on out-of-memory; disable that behavior for= shared +# library builds. This requires libpq's pqexpbuffer.h. +# This rule overrides the previous one, so must duplicate its effects. +jsonapi_shlib.o: jsonapi.c jsonapi.o + $(CC) $(CFLAGS) $(CFLAGS_SL) -DJSONAPI_USE_PQEXPBUFFER -I$(libpq_srcdir)= $(CPPFLAGS) -c $< -o $@ + libpgcommon_excluded_shlib.a: $(OBJS_EXCLUDED_SHLIB) rm -f $@ $(AR) $(AROPT) $@ $^ ------- =_aaaaaaaaaa0--