tada / pljava

PL/Java is a free add-on module that brings Java™ Stored Procedures, Triggers, Functions, Aggregates, Operators, Types, etc., to the PostgreSQL™ backend.
http://tada.github.io/pljava/
Other
238 stars 77 forks source link

Error building against PostgreSQL 16 #466

Closed fmbiete closed 9 months ago

fmbiete commented 9 months ago

Some macros and symbols have been removed in PostgreSQL 16

[INFO] --- pljava-pgxs:1.6.5:scripted-goal (build-shared-object) @ pljava-so ---
[INFO] Using compiling/linking rules for Linux
/root/pljava-1_6_5/pljava-so/src/main/c/Function.c: In function ‘Java_org_postgresql_pljava_internal_Function__1storeToNonUDT’:
/root/pljava-1_6_5/pljava-so/src/main/c/Function.c:1242:25: error: ‘PG_FUNCNAME_MACRO’ undeclared (first use in this function); did you mean ‘PG_FUNCTION_ARGS’?
   Exception_throw_ERROR(PG_FUNCNAME_MACRO);
                         ^~~~~~~~~~~~~~~~~
                         PG_FUNCTION_ARGS
/root/pljava-1_6_5/pljava-so/src/main/c/Function.c:1242:25: note: each undeclared identifier is reported only once for each function it appears in
/root/pljava-1_6_5/pljava-so/src/main/c/Function.c: In function ‘Java_org_postgresql_pljava_internal_Function__1storeToUDT’:
/root/pljava-1_6_5/pljava-so/src/main/c/Function.c:1321:25: error: ‘PG_FUNCNAME_MACRO’ undeclared (first use in this function); did you mean ‘PG_FUNCTION_ARGS’?
   Exception_throw_ERROR(PG_FUNCNAME_MACRO);
                         ^~~~~~~~~~~~~~~~~
                         PG_FUNCTION_ARGS
/root/pljava-1_6_5/pljava-so/src/main/c/Function.c: In function ‘Java_org_postgresql_pljava_internal_Function__1reconcileTypes’:
/root/pljava-1_6_5/pljava-so/src/main/c/Function.c:1419:25: error: ‘PG_FUNCNAME_MACRO’ undeclared (first use in this function); did you mean ‘PG_FUNCTION_ARGS’?
   Exception_throw_ERROR(PG_FUNCNAME_MACRO);
                         ^~~~~~~~~~~~~~~~~
                         PG_FUNCTION_ARGS
/root/pljava-1_6_5/pljava-so/src/main/c/type/Type.c: In function ‘TypeClass_alloc2’:
/root/pljava-1_6_5/pljava-so/src/main/c/type/Type.c:1084:26: warning: cast between incompatible function types from ‘void (*)(struct PgObject_ *)’ to ‘jvalue (*)(struct Type_ *, Datum)’ {aka ‘union jvalue (*)(struct Type_ *, long unsigned int)’} [-Wcast-function-type]
  self->coerceDatum     = (DatumCoercer)_PgObject_pureVirtualCalled;
                          ^
/root/pljava-1_6_5/pljava-so/src/main/c/type/Type.c:1085:26: warning: cast between incompatible function types from ‘void (*)(struct PgObject_ *)’ to ‘Datum (*)(struct Type_ *, struct _jobject *)’ {aka ‘long unsigned int (*)(struct Type_ *, struct _jobject *)’} [-Wcast-function-type]
  self->coerceObject    = (ObjectCoercer)_PgObject_pureVirtualCalled;
                          ^
/root/pljava-1_6_5/pljava-so/src/main/c/type/Type.c: In function ‘Type_registerType’:
/root/pljava-1_6_5/pljava-so/src/main/c/type/Type.c:1176:3: warning: cast between incompatible function types from ‘void (*)(struct PgObject_ *)’ to ‘struct Type_ * (*)(Oid)’ {aka ‘struct Type_ * (*)(unsigned int)’} [-Wcast-function-type]
   (TypeObtainer)_PgObject_pureVirtualCalled);
   ^
/root/pljava-1_6_5/pljava-so/src/main/c/type/AclId.c: In function ‘Java_org_postgresql_pljava_internal_AclId__1hasSchemaCreatePermission’:
/root/pljava-1_6_5/pljava-so/src/main/c/type/AclId.c:214:22: warning: implicit declaration of function ‘pg_namespace_aclcheck’; did you mean ‘pg_parameter_aclcheck’? [-Wimplicit-function-declaration]
  result = (jboolean)(pg_namespace_aclcheck(Oid_getOid(oid), AclId_getAclId(aclId), ACL_CREATE) == ACLCHECK_OK);
                      ^~~~~~~~~~~~~~~~~~~~~
                      pg_parameter_aclcheck
/root/pljava-1_6_5/pljava-so/src/main/c/Backend.c: In function ‘initsequencer’:
/root/pljava-1_6_5/pljava-so/src/main/c/Backend.c:34:23: warning: implicit declaration of function ‘dlopen’; did you mean ‘open’? [-Wimplicit-function-declaration]
  #define pg_dlopen(f) dlopen((f), RTLD_NOW | RTLD_GLOBAL)
                       ^~~~~~
/root/pljava-1_6_5/pljava-so/src/main/c/Backend.c:601:19: note: in expansion of macro ‘pg_dlopen’
   libjvm_handle = pg_dlopen(libjvmlocation);
                   ^~~~~~~~~
/root/pljava-1_6_5/pljava-so/src/main/c/Backend.c:34:35: error: ‘RTLD_NOW’ undeclared (first use in this function); did you mean ‘UTIME_NOW’?
  #define pg_dlopen(f) dlopen((f), RTLD_NOW | RTLD_GLOBAL)
                                   ^~~~~~~~
/root/pljava-1_6_5/pljava-so/src/main/c/Backend.c:601:19: note: in expansion of macro ‘pg_dlopen’
   libjvm_handle = pg_dlopen(libjvmlocation);
                   ^~~~~~~~~
/root/pljava-1_6_5/pljava-so/src/main/c/Backend.c:34:35: note: each undeclared identifier is reported only once for each function it appears in
  #define pg_dlopen(f) dlopen((f), RTLD_NOW | RTLD_GLOBAL)
                                   ^~~~~~~~
/root/pljava-1_6_5/pljava-so/src/main/c/Backend.c:601:19: note: in expansion of macro ‘pg_dlopen’
   libjvm_handle = pg_dlopen(libjvmlocation);
                   ^~~~~~~~~
/root/pljava-1_6_5/pljava-so/src/main/c/Backend.c:34:46: error: ‘RTLD_GLOBAL’ undeclared (first use in this function); did you mean ‘PGC_S_GLOBAL’?
  #define pg_dlopen(f) dlopen((f), RTLD_NOW | RTLD_GLOBAL)
                                              ^~~~~~~~~~~
/root/pljava-1_6_5/pljava-so/src/main/c/Backend.c:601:19: note: in expansion of macro ‘pg_dlopen’
   libjvm_handle = pg_dlopen(libjvmlocation);
                   ^~~~~~~~~
In file included from /usr/pgsql-16/include/server/postgres.h:46,
                 from /root/pljava-1_6_5/pljava-so/src/main/c/Backend.c:14:
/root/pljava-1_6_5/pljava-so/src/main/c/Backend.c:37:23: warning: implicit declaration of function ‘dlerror’; did you mean ‘perror’? [-Wimplicit-function-declaration]
  #define pg_dlerror() dlerror()
                       ^~~~~~~
/usr/pgsql-16/include/server/utils/elog.h:147:4: note: in definition of macro ‘ereport_domain’
    __VA_ARGS__, errfinish(__FILE__, __LINE__, __func__); \
    ^~~~~~~~~~~
/root/pljava-1_6_5/pljava-so/src/main/c/Backend.c:604:4: note: in expansion of macro ‘ereport’
    ereport(WARNING, (
    ^~~~~~~
/root/pljava-1_6_5/pljava-so/src/main/c/Backend.c:606:29: note: in expansion of macro ‘pg_dlerror’
     errdetail("%s", (char *)pg_dlerror()),
                             ^~~~~~~~~~
/root/pljava-1_6_5/pljava-so/src/main/c/Backend.c:606:21: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
     errdetail("%s", (char *)pg_dlerror()),
                     ^
/usr/pgsql-16/include/server/utils/elog.h:147:4: note: in definition of macro ‘ereport_domain’
    __VA_ARGS__, errfinish(__FILE__, __LINE__, __func__); \
    ^~~~~~~~~~~
/root/pljava-1_6_5/pljava-so/src/main/c/Backend.c:604:4: note: in expansion of macro ‘ereport’
    ereport(WARNING, (
    ^~~~~~~
/root/pljava-1_6_5/pljava-so/src/main/c/Backend.c:35:24: warning: implicit declaration of function ‘dlsym’ [-Wimplicit-function-declaration]
  #define pg_dlsym(h,s) dlsym((h), (s))
                        ^~~~~
/root/pljava-1_6_5/pljava-so/src/main/c/Backend.c:617:4: note: in expansion of macro ‘pg_dlsym’
    pg_dlsym(libjvm_handle, "JNI_CreateJavaVM");
    ^~~~~~~~
/root/pljava-1_6_5/pljava-so/src/main/c/Backend.c:616:4: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
    (jint (JNICALL *)(JavaVM **, void **, void *))
    ^
/root/pljava-1_6_5/pljava-so/src/main/c/Backend.c:37:23: warning: passing argument 2 of ‘MemoryContextStrdup’ makes pointer from integer without a cast [-Wint-conversion]
  #define pg_dlerror() dlerror()
                       ^~~~~~~~~
/root/pljava-1_6_5/pljava-so/src/main/c/Backend.c:625:50: note: in expansion of macro ‘pg_dlerror’
    char *dle = MemoryContextStrdup(ErrorContext, pg_dlerror());
                                                  ^~~~~~~~~~
In file included from /usr/pgsql-16/include/server/postgres.h:47,
                 from /root/pljava-1_6_5/pljava-so/src/main/c/Backend.c:14:
/usr/pgsql-16/include/server/utils/palloc.h:155:14: note: expected ‘const char *’ but argument is of type ‘int’
 extern char *MemoryContextStrdup(MemoryContext context, const char *string);
              ^~~~~~~~~~~~~~~~~~~
/root/pljava-1_6_5/pljava-so/src/main/c/Backend.c:36:24: warning: implicit declaration of function ‘dlclose’; did you mean ‘close’? [-Wimplicit-function-declaration]
  #define pg_dlclose(h) dlclose((h))
                        ^~~~~~~
/root/pljava-1_6_5/pljava-so/src/main/c/Backend.c:626:4: note: in expansion of macro ‘pg_dlclose’
    pg_dlclose(libjvm_handle);
    ^~~~~~~~~~
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] PostgreSQL PL/Java 1.6.5 ........................... SUCCESS [  1.328 s]
[INFO] PL/Java API ........................................ SUCCESS [  4.338 s]
[INFO] PL/Java backend Java code .......................... SUCCESS [  4.039 s]
[INFO] PL/Java PGXS ....................................... SUCCESS [  3.426 s]
[INFO] PL/Java backend native code ........................ FAILURE [  9.457 s]
jcflack commented 9 months ago

Does your build succeed using the branch in PR #451 ?

If so, the PL/Java release once PG 16 comes out should be ok.

fmbiete commented 9 months ago

Yes, it succeeds against that branch with PostgreSQL 16.0 GA

jcflack commented 9 months ago

I confirmed that a couple days ago and merged that branch.

I rarely recall such a close span between a PG release and a Java release; Java 21 is GA tomorrow, so I think I'll wait for that and confirm there's no funny business, then do a release.

jcflack commented 9 months ago

Believed resolved in 1.6.6.