Build failure with PG15: src/rumsort.c:1316:38: error: too many arguments to function ‘LogicalTapeBackspace’
df7cb opened this issue · 14 comments
21:36:33 ### PostgreSQL 15 loop ###
21:36:33 # 15: make
21:36:33 make[1]: Entering directory '/<<PKGBUILDDIR>>'
21:36:33 gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Werror=vla -Wendif-labels -Wmissing-format-attribute -Wimplicit-fallthrough=3 -Wcast-function-type -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -Wno-format-truncation -Wno-stringop-truncation -g -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -fno-omit-frame-pointer -g -O2 -ffile-prefix-map=/<<PKGBUILDDIR>>=. -fstack-protector-strong -Wformat -Werror=format-security -fPIC -I. -I./ -I/usr/include/postgresql/15/server -I/usr/include/postgresql/internal -Wdate-time -D_FORTIFY_SOURCE=2 -D_GNU_SOURCE -I/usr/include/libxml2 -c -o src/rumsort.o src/rumsort.c
21:36:33 src/rumsort.c: In function ‘rum_tuplesort_gettuple_common’:
21:36:33 src/rumsort.c:1316:64: warning: passing argument 1 of ‘LogicalTapeBackspace’ from incompatible pointer type [-Wincompatible-pointer-types]
21:36:33 1316 | if (!LogicalTapeBackspace(state->tapeset,
21:36:33 | ~~~~~^~~~~~~~~
21:36:33 | |
21:36:33 | LogicalTapeSet *
21:36:33 In file included from src/rumsort.c:24:
21:36:33 /usr/include/postgresql/15/server/utils/logtape.h:72:49: note: expected ‘LogicalTape *’ but argument is of type ‘LogicalTapeSet *’
21:36:33 72 | extern size_t LogicalTapeBackspace(LogicalTape *lt, size_t size);
21:36:33 | ~~~~~~~~~~~~~^~
21:36:33 src/rumsort.c:1316:38: error: too many arguments to function ‘LogicalTapeBackspace’
21:36:33 1316 | if (!LogicalTapeBackspace(state->tapeset,
21:36:33 | ^~~~~~~~~~~~~~~~~~~~
21:36:33 In file included from src/rumsort.c:24:
21:36:33 /usr/include/postgresql/15/server/utils/logtape.h:72:15: note: declared here
21:36:33 72 | extern size_t LogicalTapeBackspace(LogicalTape *lt, size_t size);
21:36:33 | ^~~~~~~~~~~~~~~~~~~~
21:36:33 src/rumsort.c:1328:64: warning: passing argument 1 of ‘LogicalTapeBackspace’ from incompatible pointer type [-Wincompatible-pointer-types]
21:36:33 1328 | if (!LogicalTapeBackspace(state->tapeset,
21:36:33 | ~~~~~^~~~~~~~~
21:36:33 | |
21:36:33 | LogicalTapeSet *
21:36:33 In file included from src/rumsort.c:24:
21:36:33 /usr/include/postgresql/15/server/utils/logtape.h:72:49: note: expected ‘LogicalTape *’ but argument is of type ‘LogicalTapeSet *’
21:36:33 72 | extern size_t LogicalTapeBackspace(LogicalTape *lt, size_t size);
21:36:33 | ~~~~~~~~~~~~~^~
21:36:33 src/rumsort.c:1328:38: error: too many arguments to function ‘LogicalTapeBackspace’
21:36:33 1328 | if (!LogicalTapeBackspace(state->tapeset,
21:36:33 | ^~~~~~~~~~~~~~~~~~~~
...
Full build log: https://pgdgbuild.dus.dg-i.net/view/Binaries-Beta/job/postgresql-rum-binaries-beta/15/architecture=amd64,distribution=sid/console
Thanks. Could you tag that as a new release so I can update the Debian package?
Stamped 1.3.10
Thanks!
I'm afraid something broke there:
--- /srv/projects/postgresql/rum/rum/expected/security.out 2021-06-30 14:21:19.533586666 +0200
+++ /srv/projects/postgresql/rum/rum/results/security.out 2022-05-26 11:26:37.627962177 +0200
@@ -1,5 +1,5 @@
-- Check security CVE-2020-14350
CREATE FUNCTION rum_anyarray_similar(anyarray,anyarray) RETURNS bool AS $$ SELECT false $$ LANGUAGE SQL;
CREATE EXTENSION rum;
-ERROR: function "rum_anyarray_similar" already exists with same argument types
+ERROR: could not load library "/home/cbe/postgresql/rum/rum/debian/postgresql-14-rum/usr/lib/postgresql/14/lib/rum.so": /home/cbe/postgresql/rum/rum/debian/postgresql-14-rum/usr/lib/postgresql/14/lib/rum.so: undefined symbol: postgresql_sort__done_semaphore
All PG versions (10..14) are affected.
Tried to reproduce this on PG 14.0-14.3
make USE_PGXS=1 distclean
make USE_PGXS=1
make USE_PGXS=1 install
make USE_PGXS=1 installcheck
I haven't found any faults. Can you try to clean and try again? Or please specify how do you build rum/Postgres and which branch states you use?
I can reproduce the problem in several environments (notebook, Debian CI host, apt.postgresql.org buildd). Running directly on the 1.3.10 tag without the debian/ bits:
make USE_PGXS=1 distclean
make USE_PGXS=1
sudo make USE_PGXS=1 install
pg_virtualenv make USE_PGXS=1 installcheck
Creating new PostgreSQL cluster 14/regress ...
/usr/lib/postgresql/14/lib/pgxs/src/makefiles/../../src/test/regress/pg_regress --inputdir=./ --bindir='/usr/lib/postgresql/14/bin' --dbname=contrib_regression security rum rum_validate rum_hash ruminv timestamp orderby orderby_hash altorder altorder_hash limits int2 int4 int8 float4 float8 money oid time timetz date interval macaddr inet cidr text varchar char bytea bit varbit numeric rum_weight array
(using postmaster on localhost, port 5433)
============== dropping database "contrib_regression" ==============
HINWEIS: Datenbank »contrib_regression« existiert nicht, wird übersprungen
DROP DATABASE
============== creating database "contrib_regression" ==============
CREATE DATABASE
ALTER DATABASE
============== running regression test queries ==============
test security ... FAILED 39 ms
...
head regression.diffs
diff -U3 /srv/projects/postgresql/rum/rum/expected/security.out /srv/projects/postgresql/rum/rum/results/security.out
--- /srv/projects/postgresql/rum/rum/expected/security.out 2022-05-25 22:37:42.000000000 +0200
+++ /srv/projects/postgresql/rum/rum/results/security.out 2022-05-26 14:16:00.743831887 +0200
@@ -1,5 +1,5 @@
-- Check security CVE-2020-14350
CREATE FUNCTION rum_anyarray_similar(anyarray,anyarray) RETURNS bool AS $$ SELECT false $$ LANGUAGE SQL;
CREATE EXTENSION rum;
-ERROR: function "rum_anyarray_similar" already exists with same argument types
+ERROR: could not load library "/usr/lib/postgresql/14/lib/rum.so": /usr/lib/postgresql/14/lib/rum.so: undefined symbol: postgresql_sort__done_semaphore
DROP FUNCTION rum_anyarray_similar(anyarray,anyarray);
psql (14.3 (Debian 14.3-1+b1)) on Debian unstable/amd64
Can you tell me postgres branch state? I see 14.3-1+b1 and can not understand what's that state of 14 branch (tried the newest one, though and found no problems with it). I start to suppose some problem with PostgreSQL package you used. Have you tried PG built from source?
Again I would continue trying to reproduce if knew PG branch state that fails.
BTW looks similar to the problem reported (unrelated to RUM): https://www.postgresql.org/message-id/16555-de24d39c1e421f14%40postgresql.org
I'm building PG from source all the time since I'm the one who puts the packages into Debian and apt.postgresql.org where 14.3-1+b1 is coming from.
rum branch is the 1.3.10 tag.
There is a reported problem with building Postgres with link-time-optimization i.e. -flto CFLAG (link above). Is it possible to disable it?
I don't think LTO is being used in the PG builds; only the .bc files used for llvmjit are lto-ized, but neither the PG server build [1] nor the rum build [2].
[1] https://buildd.debian.org/status/fetch.php?pkg=postgresql-14&arch=amd64&ver=14.3-1%2Bb1&stamp=1652502731&raw=0
[2] https://pgdgbuild.dus.dg-i.net/job/postgresql-rum-binaries/34/architecture=amd64,distribution=sid/console
But it indeed looks like the problem is something in that direction.
I guess the breaking change since 1.3.9 is that rum is now re-defining the tuplesort machinery from core PG. I don't understand yet why that's necessary, but at least the bit where it's overwriting the trace_sort GUC seems wrong (it should use the existing definition):
https://github.com/postgrespro/rum/blob/master/src/tuplesort14.c#L140