Re: AIX support

From: Andres Freund <andres(at)anarazel(dot)de>
To: Robert Haas <robertmhaas(at)gmail(dot)com>, Michael Paquier <michael(at)paquier(dot)xyz>
Cc: Aditya Kamath <Aditya(dot)Kamath1(at)ibm(dot)com>, Srirama Kucherlapati <sriram(dot)rk(at)in(dot)ibm(dot)com>, "peter(at)eisentraut(dot)org" <peter(at)eisentraut(dot)org>, "pgsql-hackers(at)lists(dot)postgresql(dot)org" <pgsql-hackers(at)lists(dot)postgresql(dot)org>, "hlinnaka(at)iki(dot)fi" <hlinnaka(at)iki(dot)fi>, "tristan(at)partin(dot)io" <tristan(at)partin(dot)io>, "postgres-ibm-aix(at)wwpdl(dot)vnet(dot)ibm(dot)com" <postgres-ibm-aix(at)wwpdl(dot)vnet(dot)ibm(dot)com>
Subject: Re: AIX support
Date: 2026-01-28 17:33:01
Message-ID: vua2n6svb6fac3fmz42ahqxndmgbgor7vpxtemis5evasfpzb3@ogs4ewexkpjm
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

On 2026-01-28 10:41:52 -0500, Robert Haas wrote:
> On Wed, Jan 28, 2026 at 10:20 AM Aditya Kamath <Aditya(dot)Kamath1(at)ibm(dot)com> wrote:
> > But here is the catch. It won’t pick the AIX system float.h. It will pick the Postgres "src/include/utilsfloat.h”.
>
> PostgreSQL's header should always be included as "utils/float.h" and
> the system header should always be included as "float.h" (or, well,
> <float.h>, presumably). So this confusion should not exist unless the
> include paths are messed up. It doesn't seem correct to me that the
> include path includes src/include/utils rather than just src/include,
> but I see the same thing here:

I agree that this is wrong.

CCing Michael and Bertrand, they added this in fa88928470b5 and 1e68e43d3f0f.

> which happens because of:
>
> wait_event = static_library('wait_event_names',
> waitevent_sources,
> dependencies: [backend_code],
> include_directories: include_directories('../../../include/utils'),
> kwargs: internal_lib_args,
> )
>
> 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 reason for that is that the same invocation also generates
wait_event_types.h, which is included by other headers.

> The attached patch, which also adjusts wait_events.c, fixes it for me.

Unfortunately I suspect that'll cause issues with make builds, because there
the files are generated in a different place (src/backend/activity) and then
only wait_event_types.h is copied to src/include. So including the files as
utils/ won't work.

I'd fix that aspect by doing the same thing in the autoconf build as we do in
meson, i.e. keep the file in the include dir. We already do that e.g. for
guc_tables.inc.c, see this src/backend/utils/Makefile stanza:

# These generated headers must be symlinked into src/include/.
# We use header-stamp to record that we've done this because the symlinks
# themselves may appear older than fmgr-stamp.
$(top_builddir)/src/include/utils/header-stamp: fmgr-stamp errcodes.h probes.h guc_tables.inc.c
cd '$(dir $@)' && for file in fmgroids.h fmgrprotos.h errcodes.h probes.h guc_tables.inc.c; do \
rm -f $$file && $(LN_S) "../../../$(subdir)/$$file" . ; \
done
touch $@

Alternatively: I'm not a fan of including .c files that are not actually
working C. You could just make wait_event_funcs_data.c be a complete C file,
defining waitEventData, that is then built as a standalone file.

Greetings,

Andres Freund

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2026-01-28 17:52:22 Re: unnecessary executor overheads around seqscans
Previous Message Hannu Krosing 2026-01-28 17:29:58 Re: Patch: dumping tables data in multiple chunks in pg_dump