qtl icon indicating copy to clipboard operation
qtl copied to clipboard

Compile error for Postgres

Open i47320673 opened this issue 3 years ago • 3 comments

Hello. Excellent library. Thank you.

I tried to build tests through GNU make. I've got a lot compile time errors.

g++ -g -D_DEBUG -O2 -I/usr/include -I/usr/local/include -I/usr/include/postgresql -I/usr/include/postgresql/12/server -I../include -std=c++11 -x c++-header -o stdafx.h.gch stdafx.h g++ -c -g -D_DEBUG -O2 -I/usr/include -I/usr/local/include -I/usr/include/postgresql -I/usr/include/postgresql/12/server -I../include -std=c++11 -o TestPostgres.o TestPostgres.cpp In file included from /usr/include/postgresql/12/server/nodes/parsenodes.h:27, from /usr/include/postgresql/12/server/utils/acl.h:36, from /usr/include/postgresql/12/server/catalog/objectaddress.h:18, from /usr/include/postgresql/12/server/catalog/pg_type.h:24, from ../include/qtl_postgres.hpp:31, from TestPostgres.cpp:8: /usr/include/postgresql/12/server/nodes/primnodes.h:200:2: error: ‘Datum’ does not name a type; did you mean ‘outDatum’? 200 | Datum constvalue; /* the constant's value */ | ^~~~~ | outDatum In file included from /usr/include/postgresql/12/server/utils/acl.h:37, from /usr/include/postgresql/12/server/catalog/objectaddress.h:18, from /usr/include/postgresql/12/server/catalog/pg_type.h:24, from ../include/qtl_postgres.hpp:31, from TestPostgres.cpp:8: /usr/include/postgresql/12/server/parser/parse_node.h:263:2: error: ‘ErrorContextCallback’ does not name a type 263 | ErrorContextCallback errcallback; | ^~~~~~~~~~~~~~~~~~~~ ....

Software versions:

Ubuntu 20.04 GNU Make 4.2.1 g++ (Ubuntu 9.4.0-1ubuntu1~20.04.1) 9.4.0 postgresql-client-12 (12.12-0ubuntu0.20.04.1) postgresql-client-common (214ubuntu0.1) postgresql-server-dev-12:amd64 (12.12-0ubuntu0.20.04.1) libpgtypes3:amd64 (12.12-0ubuntu0.20.04.1) libecpg6:amd64 (12.12-0ubuntu0.20.04.1) libecpg-compat3:amd64 (12.12-0ubuntu0.20.04.1) libecpg-dev (12.12-0ubuntu0.20.04.1) …

Seems missing #include in <qtl/qtl_postgres.hpp>

//... extern "C" { #include <postgres.h> // NEED THIS FOR COMPILE // #include <c.h> #include <catalog/pg_type.h> }

//...

Building was finished OK after this addition.

i47320673 avatar Nov 17 '22 18:11 i47320673

This problem seems to be related to the PostgreSQL version.

znone avatar Nov 21 '22 08:11 znone

I've not checked this for another (lower/upper) versions but for 12 that occurred.

i47320673 avatar Nov 21 '22 09:11 i47320673

At that time, I used PostgreSQL 10.6 and debugged these header files for a long time.

znone avatar Nov 21 '22 15:11 znone