On 2026-Jan-28, Robert Haas wrote:
> [...]
> which happens because wait_event_funcs.c contains:
>
> #include "wait_event_funcs_data.c"
>
> and for some reason, that file gets placed in src/include/utils.
>
> The attached patch, which also adjusts wait_events.c, fixes it for me.
Hmm, I think this setup is bogus and that your patch is clearly an
improvement. Unfortunately, it doesn't work under Make using a VPATH
build; see below.
> This is kind of a good example of how you are not pursuing your goals
> here in the best way possible.
I agree.
It seems the files are being generated in the wrong place
(src/backend/utils/activity). This is what I get:
make -C utils/activity wait_event_types.h pgstat_wait_event.c
wait_event_funcs_data.c
'/usr/bin/perl'
/pgsql/source/master/src/backend/utils/activity/generate-wait_event_types.pl
--code /pgsql/source/master/src/backend/utils/activity/wait_event_names.txt
make[2]: 'pgstat_wait_event.c' is up to date.
make[2]: Nothing to be done for 'wait_event_funcs_data.c'.
prereqdir=`cd 'utils/activity/' >/dev/null && pwd` && \
cd '../../src/include/utils/' && rm -f wait_event_types.h && \
ln -s "$prereqdir/wait_event_types.h" .
[... much later ...]
gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement
-Werror=vla -Wendif-labels -Wmissing-format-attribute -Wimplicit-fallthrough=3
-Wcast-function-type -Wshadow=compatible-local -Wformat-security
-Wmissing-variable-declarations -fno-strict-aliasing -fwrapv
-fexcess-precision=standard -Wno-format-truncation -Wno-stringop-truncation -g
-O2 -I. -I/pgsql/source/master/src/backend/utils/activity
-I../../../../src/include -I/pgsql/source/master/src/include -D_GNU_SOURCE
-c -o wait_event.o /pgsql/source/master/src/backend/utils/activity/wait_event.c
-MMD -MP -MF .deps/wait_event.Po
/pgsql/source/master/src/backend/utils/activity/wait_event.c:506:10: fatal
error: utils/pgstat_wait_event.c: No such file or directory
506 | #include "utils/pgstat_wait_event.c"
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
make[4]: *** [../../../../src/Makefile.global:972: wait_event.o] Error 1
make[3]: *** [/pgsql/source/master/src/backend/common.mk:37:
activity-recursive] Error 2
make[2]: *** [/pgsql/source/master/src/backend/common.mk:37: utils-recursive]
Error 2
Now I have these files:
$ find . -name \*wait_event\*.[ch]
./src/backend/utils/activity/wait_event_types.h
./src/backend/utils/activity/pgstat_wait_event.c
./src/backend/utils/activity/wait_event_funcs_data.c
./src/include/utils/wait_event_types.h
Not sure what a good fix for this is.
--
Álvaro Herrera 48°01'N 7°57'E — https://www.EnterpriseDB.com/
"I am amazed at [the pgsql-sql] mailing list for the wonderful support, and
lack of hesitasion in answering a lost soul's question, I just wished the rest
of the mailing list could be like this." (Fotis)
https://postgr.es/m/[email protected]