pg_probackup build issue with PostgreSQL 18beta1 due to pg_detoast_datum_packed() - Mailing list pgsql-hackers

From Japin Li
Subject pg_probackup build issue with PostgreSQL 18beta1 due to pg_detoast_datum_packed()
Date
Msg-id ME0P300MB0445018F5C924B2D88983F45B66CA@ME0P300MB0445.AUSP300.PROD.OUTLOOK.COM
Whole thread Raw
List pgsql-hackers
Hi, hackers

I've run into a build issue when trying to use pg_probackup with PostgreSQL
18beta1.  After some adjustments to pg_probackup, I encountered the following
linker errors:

/usr/bin/ld: src/pg_crc.o: in function `crc32_bytea':
/home/japin/Codes/extensions/pg_probackup/src/pg_crc.c:109:(.text+0x40): undefined reference to
`pg_detoast_datum_packed'
/usr/bin/ld: src/pg_crc.o: in function `crc32c_bytea':
/home/japin/Codes/extensions/pg_probackup/src/pg_crc.c:122:(.text+0x1a1): undefined reference to
`pg_detoast_datum_packed'
collect2: error: ld returned 1 exit status
make: *** [/data/Codes/ngdb/main/build/ngdb/lib/postgresql/pgxs/src/makefiles/pgxs.mk:478: pg_probackup] Error 1

It appears that PostgreSQL commit 760162f introduced user-callable CRC
functions.  Since pg_probackup leverages pg_crc.c from the PostgreSQL source,
this change is leading to the "undefined reference to pg_detoast_datum_packed"
errors during the build.

To resolve this, I'm wondering about wrapping these user-callable CRC functions
with an #ifndef FRONTEND block:

#ifndef FRONTEND
... // user-callable CRC functions here
#endif

This would ensure these functions are only included in the backend compilation
and avoid linker issues when building extensions like pg_probackup.

Any thoughts or alternative suggestions would be greatly appreciated!

-- 
Regards,
Japin Li


Attachment

pgsql-hackers by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: C11 / VS 2019
Next
From: Florents Tselai
Date:
Subject: Re: encode/decode support for base64url