From: | Peter Dyballa <Peter_Dyballa(at)Web(dot)DE> |
---|---|
To: | pgsql-bugs(at)lists(dot)postgresql(dot)org |
Cc: | Thomas Munro <thomas(dot)munro(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Subject: | Re: BUG #19062: PostgreSQL 12.22 does not compile because of conflicting types for CollationCreate |
Date: | 2025-10-02 19:53:00 |
Message-ID: | D84FCBB7-4F4C-41F3-82DD-FCE904A8B0A4@Web.DE |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
From examining the pre-processed code I saw
# 32 "/usr/lib/gcc/powerpc-apple-darwin9/4.2.1/include/stdbool.h" 3 4
#define _STDBOOL_H
or
# 29 "/opt/local/lib/gcc14/gcc/powerpc-apple-darwin9/14.2.0/include/stdbool.h" 3 4
#define _STDBOOL_H
and thought "It's already there", but I let PostgreSQL 12.22 build with that explicit define:
/usr/bin/gcc-4.2 -std=gnu99 -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -pipe -I/opt/local/libexec/openssl3/include -Os -arch ppc -I../../../src/include -I/opt/local/libexec/openssl3/include -isystem/opt/local/include -D__STDBOOL_H -I/opt/local/include/libxml2 -I/opt/local/include -c -o pg_collation.o pg_collation.c
pg_collation.c:55: error: conflicting types for ‘CollationCreate’
../../../src/include/catalog/pg_collation.h:70: error: previous declaration of ‘CollationCreate’ was here
pg_collation.c: In function ‘CollationCreate’:
pg_collation.c:196: warning: passing argument 3 of ‘heap_form_tuple’ from incompatible pointer type
vs.
/opt/local/bin/gcc-mp-14 -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Werror=vla -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -Wno-format-truncation -Wno-stringop-truncation -pipe -I/opt/local/libexec/openssl3/include -Os -arch ppc -I../../../src/include -I/opt/local/libexec/openssl3/include -isystem/opt/local/include -D__STDBOOL_H -I/opt/local/include/libxml2 -I/opt/local/include -c -o pg_collation.o pg_collation.c
pg_collation.c:46:1: error: conflicting types for 'CollationCreate'; have 'Oid(const char *, Oid, Oid, char, _Bool, int32, const char *, const char *, const char *, _Bool, _Bool)' {aka 'unsigned int(const char *, unsigned int, unsigned int, char, _Bool, int, const char *, const char *, const char *, _Bool, _Bool)'}
46 | CollationCreate(const char *collname, Oid collnamespace,
| ^~~~~~~~~~~~~~~
In file included from pg_collation.c:25:
../../../src/include/catalog/pg_collation.h:62:17: note: previous declaration of 'CollationCreate' with type 'Oid(const char *, Oid, Oid, char, bool, int32, const char *, const char *, const char *, bool, bool)' {aka 'unsigned int(const char *, unsigned int, unsigned int, char, unsigned char, int, const char *, const char *, const char *, unsigned char, unsigned char)'}
62 | extern Oid CollationCreate(const char *collname, Oid collnamespace,
| ^~~~~~~~~~~~~~~
pg_collation.c: In function 'CollationCreate':
pg_collation.c:196:48: error: passing argument 3 of 'heap_form_tuple' from incompatible pointer type [-Wincompatible-pointer-types]
196 | tup = heap_form_tuple(tupDesc, values, nulls);
| ^~~~~
| |
| _Bool *
In file included from pg_collation.c:18:
../../../src/include/access/htup_details.h:794:87: note: expected 'bool *' {aka 'unsigned char *'} but argument is of type '_Bool *'
794 | Datum *values, bool *isnull);
| ~~~~~~^~~~~~
So this additional flag brings indeed no change.
--------------------
When trying to remove XML support I found that XSLT support has to be cancelled explicitly (configure tests need libxml/tree.h). I think this could be automated – XSLT support is not possible without libxml2, is it?
Anyway, the builds fail with similar messages:
/usr/bin/gcc-4.2 -std=gnu99 -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -pipe -I/opt/local/libexec/openssl3/include -Os -arch ppc -I../../../src/include -I/opt/local/libexec/openssl3/include -isystem/opt/local/include -I/opt/local/include -c -o pg_collation.o pg_collation.c
pg_collation.c:55: error: conflicting types for ‘CollationCreate’
../../../src/include/catalog/pg_collation.h:70: error: previous declaration of ‘CollationCreate’ was here
pg_collation.c: In function ‘CollationCreate’:
pg_collation.c:196: warning: passing argument 3 of ‘heap_form_tuple’ from incompatible pointer type
gnumake[3]: *** [pg_collation.o] Error 1
gnumake[3]: Leaving directory `/opt/local/var/macports/build/postgresql12-5f1ceb12/work/postgresql-12.22/src/backend/catalog'
vs.
/opt/local/bin/gcc-mp-14 -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Werror=vla -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -Wno-format-truncation -Wno-stringop-truncation -pipe -I/opt/local/libexec/openssl3/include -Os -arch ppc -I../../../src/include -I/opt/local/libexec/openssl3/include -isystem/opt/local/include -I/opt/local/include -c -o pg_collation.o pg_collation.c
pg_collation.c:46:1: error: conflicting types for 'CollationCreate'; have 'Oid(const char *, Oid, Oid, char, _Bool, int32, const char *, const char *, const char *, _Bool, _Bool)' {aka 'unsigned int(const char *, unsigned int, unsigned int, char, _Bool, int, const char *, const char *, const char *, _Bool, _Bool)'}
46 | CollationCreate(const char *collname, Oid collnamespace,
| ^~~~~~~~~~~~~~~
In file included from pg_collation.c:25:
../../../src/include/catalog/pg_collation.h:62:17: note: previous declaration of 'CollationCreate' with type 'Oid(const char *, Oid, Oid, char, bool, int32, const char *, const char *, const char *, bool, bool)' {aka 'unsigned int(const char *, unsigned int, unsigned int, char, unsigned char, int, const char *, const char *, const char *, unsigned char, unsigned char)'}
62 | extern Oid CollationCreate(const char *collname, Oid collnamespace,
| ^~~~~~~~~~~~~~~
pg_collation.c: In function 'CollationCreate':
pg_collation.c:196:48: error: passing argument 3 of 'heap_form_tuple' from incompatible pointer type [-Wincompatible-pointer-types]
196 | tup = heap_form_tuple(tupDesc, values, nulls);
| ^~~~~
| |
| _Bool *
In file included from pg_collation.c:18:
../../../src/include/access/htup_details.h:794:87: note: expected 'bool *' {aka 'unsigned char *'} but argument is of type '_Bool *'
794 | Datum *values, bool *isnull);
| ~~~~~~^~~~~~
gnumake[3]: *** [pg_collation.o] Error 1
gnumake[3]: Leaving directory `/opt/local/var/macports/build/postgresql12-5f1ceb12/work/postgresql-12.22/src/backend/catalog'
Adding -D__STDBOOL_H brings no real change, so the culprit could be ICU. Configuring without ICU brings success. With both compilers and with all tests. Solution #1.
--------------------
I am building in a MacPorts environment, for convenience. So its own XML and ICU installations get used. With Mac OS X 10.5.8, Leopard, /usr/lib/libxml2.2.dylib is installed – and ICU only partially: /usr/lib/libicucore.dylib. OTOH MacPorts has a patch file for building PostgreSQL versions 13…17 with ICU:
--- src/include/utils/pg_locale.h.orig 2022-08-09 04:44:29.000000000 +0800
+++ src/include/utils/pg_locale.h 2022-10-25 01:49:09.000000000 +0800
@@ -17,6 +17,9 @@
#endif
#ifdef USE_ICU
#include <unicode/ucol.h>
+#ifdef bool
+#undef bool
+#endif
#endif
#include "utils/guc.h"
--- src/backend/utils/adt/formatting.c.orig 2022-10-25 02:07:10.000000000 +0800
+++ src/backend/utils/adt/formatting.c 2022-10-25 02:07:21.000000000 +0800
@@ -81,6 +81,9 @@
#ifdef USE_ICU
#include <unicode/ustring.h>
+#ifdef bool
+#undef bool
+#endif
#endif
#include "catalog/pg_collation.h"
Quite simple… It removes the type _Bool from the pre-processed output. Applying it also for version 12.22 brings success when configuring with XML, XSLT, and ICU support. The C header files <unicode/ucol.h> and <unicode/ustring.h> are both from MacPorts' ICU installation. Solution #2.
It's time to upgrade anyway. Thanks for your support, encouraging me to dig a bit on the surface.
--
Greetings
Pete 0
%-/\_//
(*)(*)
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2025-10-02 20:13:55 | Re: BUG #19069: pg_advisory_xact_lock() in a WITH query doesn't work |
Previous Message | PG Bug reporting form | 2025-10-02 16:25:58 | BUG #19070: issue with DETACH PARTITION CONCURRENTLY on a hash partition table |