diff mbox series

[meta-networking,07/29] pgpool2: Define SIZEOF_LONG and SIZEOF_LONG_LONG

Message ID 20261023065350.3228996-7-khem.raj@oss.qualcomm.com
State New
Headers show
Series [meta-oe,01/29] castxml: upgrade 0.7.0 -> 0.8.0 | expand

Commit Message

Khem Raj Oct. 23, 2026, 6:53 a.m. UTC
When cross compiling for a 32-bit target such as riscv32, configure
cannot test the long long snprintf format and builds the replacement
snprintf(), which fails because SIZEOF_LONG and SIZEOF_LONG_LONG are
never defined:

  snprintf.c:651:2: error: "cannot find integer type of the same size as size_t"

Add a patch that checks the size of long and long long in configure.

AI-Generated: Uses Claude Code
Signed-off-by: Khem Raj <khem.raj@oss.qualcomm.com>
---
 ...Check-the-size-of-long-and-long-long.patch | 39 +++++++++++++++++++
 .../recipes-support/pgpool2/pgpool2_4.7.3.bb  |  1 +
 2 files changed, 40 insertions(+)
 create mode 100644 meta-networking/recipes-support/pgpool2/pgpool2/0002-configure-Check-the-size-of-long-and-long-long.patch
diff mbox series

Patch

diff --git a/meta-networking/recipes-support/pgpool2/pgpool2/0002-configure-Check-the-size-of-long-and-long-long.patch b/meta-networking/recipes-support/pgpool2/pgpool2/0002-configure-Check-the-size-of-long-and-long-long.patch
new file mode 100644
index 0000000000..ef546383a6
--- /dev/null
+++ b/meta-networking/recipes-support/pgpool2/pgpool2/0002-configure-Check-the-size-of-long-and-long-long.patch
@@ -0,0 +1,39 @@ 
+From: Khem Raj <khem.raj@oss.qualcomm.com>
+Date: Wed, 21 Oct 2026 01:00:00 -0700
+Subject: [PATCH] configure: Check the size of long and long long
+
+The replacement snprintf() in src/parser/snprintf.c handles the %z
+length modifier by comparing SIZEOF_SIZE_T with SIZEOF_LONG and
+SIZEOF_LONG_LONG, but configure only defines SIZEOF_UNSIGNED_LONG,
+SIZEOF_VOID_P and SIZEOF_SIZE_T. The undefined macros evaluate to 0 in
+the #if, so whenever the replacement snprintf() is built it fails with
+
+  snprintf.c:651:2: error: "cannot find integer type of the same size as size_t"
+
+This happens e.g. when cross compiling for a 32-bit target such as
+riscv32, where configure cannot run its long long snprintf format test
+and falls back to the replacement implementation.
+
+Check the size of long and long long so these are defined on every
+target.
+
+Upstream-Status: Submitted [https://www.postgresql.org/message-id/20261021153104.43840-1-khem.raj%40oss.qualcomm.com]
+Signed-off-by: Khem Raj <khem.raj@oss.qualcomm.com>
+---
+ configure.ac | 5 +++++
+ 1 file changed, 5 insertions(+)
+
+--- a/configure.ac
++++ b/configure.ac
+@@ -211,6 +211,11 @@
+ AC_CHECK_SIZEOF([void *])
+ AC_CHECK_SIZEOF([size_t])
+
++# The replacement snprintf() compares SIZEOF_SIZE_T against these to handle
++# the %z length modifier
++AC_CHECK_SIZEOF([long])
++AC_CHECK_SIZEOF([long long])
++
+ # Decide whether float4 is passed by value: user-selectable, enabled by default
+ AC_MSG_CHECKING([whether to build with float4 passed by value])
+ PGAC_ARG_BOOL(enable, float4-byval, yes, [disable float4 passed by value],
diff --git a/meta-networking/recipes-support/pgpool2/pgpool2_4.7.3.bb b/meta-networking/recipes-support/pgpool2/pgpool2_4.7.3.bb
index 2648cc1f9f..d5f1f75d4e 100644
--- a/meta-networking/recipes-support/pgpool2/pgpool2_4.7.3.bb
+++ b/meta-networking/recipes-support/pgpool2/pgpool2_4.7.3.bb
@@ -13,6 +13,7 @@  LIC_FILES_CHKSUM = "file://COPYING;md5=e4b38de086d73e0521de0bbdbaa4a1a9"
 SRC_URI = "https://www.pgpool.net/source/pgpool-II-${PV}.tar.gz \
 	   file://0001-Fix-build-error-when-build-this-file.patch \
 	   file://define_SIGNAL_ARGS.patch \
+	   file://0002-configure-Check-the-size-of-long-and-long-long.patch \
 	   file://pgpool.sysconfig \
 	   file://pgpool.service \
            "