agora inbox for pgsql-bugs@postgresql.org
help / color / mirror / Atom feedFrom: Tom Lane <tgl@sss.pgh.pa.us>
To: Ross Burton <ross@burtonini.com>
Cc: pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #19727: pg-combinebackup fails to link
Date: Wed, 30 Sep 2026 11:24:56 -0400
Message-ID: <859825.1790781896@sss.pgh.pa.us> (raw)
In-Reply-To: <769387.1790775367@sss.pgh.pa.us>
References: <19727-32d67d9dea410f38@postgresql.org>
<599939.1790693300@sss.pgh.pa.us>
<CAAnfSTuR1mwjfLQ1OB+79TwN+B2dP8Zp7Y78d7GNvFsa2dMdew@mail.gmail.com>
<682272.1790695839@sss.pgh.pa.us>
<CAAnfSTthF_ON_NijsqN8ys=Z=CDzQyBoBUy1osgxN6PpTW8V-A@mail.gmail.com>
<CAAnfSTv_Vj9oH2vUs56KwDdbmfrOhuTb1o+6TXzBW_uUjOJpkg@mail.gmail.com>
<769387.1790775367@sss.pgh.pa.us>
I wrote:
> Ross Burton <ross@burtonini.com> 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
Attachments:
[text/x-diff] v1-fix-makefile-variable-usage.patch (1.3K, ../859825.1790781896@sss.pgh.pa.us/2-v1-fix-makefile-variable-usage.patch)
download | inline diff:
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 += -DJSONAPI_USE_PQEXPBUFFER
-jsonapi_shlib.o: override CPPFLAGS := -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 := -I$(libpq_srcdir) $(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) $@ $^
view thread (8+ messages)
Message-ID: <859825.1790781896@sss.pgh.pa.us>
Permalink: ../859825.1790781896@sss.pgh.pa.us/
Also on: postgresql.org/message-id/859825.1790781896@sss.pgh.pa.us
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-bugs@postgresql.org
Cc: tgl@sss.pgh.pa.us, ross@burtonini.com, pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #19727: pg-combinebackup fails to link
In-Reply-To: <859825.1790781896@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox