Make frontend programs relink after libpgfeutils changes
Hackorum builds and tests every patch posted to the lists, not only commitfest submissions. This is Hackorum's own CI rather than the PostgreSQL project's, and it is still under testing - please report anything that looks wrong.
You can run a PostgreSQL built from this patch straight from Docker, with no checkout and no build:
docker run --rm -p 5432:5432 ghcr.io/hackorum-dev/postgres-patch:t248543psql -h localhost -U postgresBuilt from patchset v4 (message #4), August 23, 2026 at 07:08 AM.
Every patchset is also pushed to a branch of our PostgreSQL fork, so you can check out the same tree CI built. Without a PostgreSQL checkout:
git clone --branch t248543_4 https://github.com/hackorum-dev/postgres.gitIn a checkout you already have, add the fork once:
git remote add hackorum https://github.com/hackorum-dev/postgres.gitthen, for this patchset and every later one:
git fetch hackorum t248543_4 && git checkout t248543_4Patchset v4 (message #4) is on t248543_4
Hi,
I ran into some trouble while working on patch [1]/messages/by-id/A44110E7-6A03-4C67-95AD-527192A6C768@gmail.com, where I changed print.c and needed to rebuild psql. However, make silently didn't rebuild psql after the print.c change. I wasn’t aware of that at first, and it confused me and wasted quite a bit of time before I figured out what was happening.
I tried a Meson build. Ninja automatically rebuilds 33 client tools after print.c changes, so I changed make to automatically rebuild client tools in the same way as Meson.
But then I found that there are actually 27 client tools that depend on libpgfeutils.a. There are 6 client tools that don’t really require libpgfeutils.a, but Meson still links the library to them. They are:
* pg_archivecleanup
* pg_config
* pg_controldata
* pg_ctl
* pg_test_fsync
* pg_test_timing
I want this patch to focus on make, and I am not as familiar with Meson as I am with make, so I didn’t touch the Meson part.
With this patch, when something like print.c in libpgfeutils.a is changed, all dependent client tools are automatically rebuilt.
See the attached patch for details. BTW, besides the client tools, test_escape also depends on libpgfeutils.a, so I included it in the patch as well.
[1]: /messages/by-id/A44110E7-6A03-4C67-95AD-527192A6C768@gmail.com
Best regards,
--
Chao Li (Evan)
HighGo Software Co., Ltd.
https://www.highgo.com/
Attachments:
v1-0001-Make-frontend-programs-relink-after-libpgfeutils-.patchapplication/octet-stream; name=v1-0001-Make-frontend-programs-relink-after-libpgfeutils-.patch; x-unix-mode=0644Download+57-40
On Mon, Jun 15, 2026 at 3:29 PM Chao Li <li.evan.chao@gmail.com> wrote:
Hi,
I ran into some trouble while working on patch [1], where I changed
print.c and needed to rebuild psql. However, make silently didn't rebuild
psql after the print.c change. I wasn’t aware of that at first, and it
confused me and wasted quite a bit of time before I figured out what was
happening.I tried a Meson build. Ninja automatically rebuilds 33 client tools after
print.c changes, so I changed make to automatically rebuild client tools in
the same way as Meson.But then I found that there are actually 27 client tools that depend on
libpgfeutils.a. There are 6 client tools that don’t really require
libpgfeutils.a, but Meson still links the library to them. They are:* pg_archivecleanup
* pg_config
* pg_controldata
* pg_ctl
* pg_test_fsync
* pg_test_timingI want this patch to focus on make, and I am not as familiar with Meson as
I am with make, so I didn’t touch the Meson part.With this patch, when something like print.c in libpgfeutils.a is changed,
all dependent client tools are automatically rebuilt.See the attached patch for details. BTW, besides the client tools,
test_escape also depends on libpgfeutils.a, so I included it in the patch
as well.[1]
/messages/by-id/A44110E7-6A03-4C67-95AD-527192A6C768@gmail.comBest regards,
--
Chao Li (Evan)
HighGo Software Co., Ltd.
https://www.highgo.com/
Thanks for the patch. I even ran into the same trouble and got frustrated,
and ended up I switched to meson build. So I'd give a big +1 to fix the
problem for make users.
I tried the patch, and it works properly. But I see meson automatically
rebuilds some more tools than src/bin/ tools, such as
contrib/oid2name/oid2name, src/tools/pg_bsd_indent/pg_bsd_indent, etc., do
you plan to handle them also?
Regards,
Yingying Chen
On 2026-Jun-16, Yingying Chen wrote:
I tried the patch, and it works properly. But I see meson automatically
rebuilds some more tools than src/bin/ tools, such as
contrib/oid2name/oid2name, src/tools/pg_bsd_indent/pg_bsd_indent, etc., do
you plan to handle them also?
Hmm, isn't that bogus? oid2name at least doesn't depend on fe_utils as
far as I can see. Maybe meson is overeagerly inheriting that dependency
from somewhere else. If that's the case then we don't want Make to do
the same (though I don't dare suggest to clean up Meson not to.)
--
Álvaro Herrera 48°01'N 7°57'E — https://www.EnterpriseDB.com/
On Jun 16, 2026, at 20:44, Álvaro Herrera <alvherre@kurilemu.de> wrote:
On 2026-Jun-16, Yingying Chen wrote:
I tried the patch, and it works properly. But I see meson automatically
rebuilds some more tools than src/bin/ tools, such as
contrib/oid2name/oid2name, src/tools/pg_bsd_indent/pg_bsd_indent, etc., do
you plan to handle them also?Hmm, isn't that bogus? oid2name at least doesn't depend on fe_utils as
far as I can see. Maybe meson is overeagerly inheriting that dependency
from somewhere else. If that's the case then we don't want Make to do
the same (though I don't dare suggest to clean up Meson not to.)--
Álvaro Herrera 48°01'N 7°57'E — https://www.EnterpriseDB.com/
Thanks for your comments. Actually, I checked that while working on v1.
There are 15 non-src/bin tools that get rebuilt by meson:
* contrib/oid2name/oid2name
* contrib/vacuumlo/vacuumlo
* src/interfaces/ecpg/preproc/ecpg
* src/interfaces/ecpg/test/pg_regress_ecpg
* src/test/isolation/isolationtester
* src/test/isolation/pg_isolation_regress
* src/test/modules/libpq_pipeline/libpq_pipeline
* src/test/modules/oauth_validator/oauth_hook_client
* src/test/modules/test_escape/test_escape
* src/test/modules/test_int128/test_int128
* src/test/modules/test_json_parser/test_json_parser_incremental
* src/test/modules/test_json_parser/test_json_parser_perf
* src/test/regress/pg_regress
* src/timezone/zic
* src/tools/pg_bsd_indent/pg_bsd_indent
Only src/test/modules/test_escape/test_escape really depends on libpgfeutils.a, and I included it in v1. I think Meson may involve some broader dependency logic that causes the others to be relinked, but I don’t want to touch that part in this patch.
PFA v2, only rebased, and with the reviewer and discussion added to the commit message.
Best regards,
--
Chao Li (Evan)
HighGo Software Co., Ltd.
https://www.highgo.com/