Project

Profile

Help

Error on compilation attempt of SaxonC 12.2 HE with Debian 12.0 WSL

Added by Martin Honnen over 1 year ago

I have upgraded my WSL Debian installation from 11.7 to 12.0 (bookworm) in the hope it would allow me to compile/run SaxonC 12; I have managed to compile and use the commands of SaxonC 12.2 HE but the cppTests compilation fails with

../../Saxon.C.API/SaxonCGlue.c: In function ‘detach_graalvm_thread’:
../../Saxon.C.API/SaxonCGlue.c:78:46: warning: unused parameter ‘env’ [-Wunused-parameter]
   78 | int detach_graalvm_thread(sxnc_environment * env)
      |                           ~~~~~~~~~~~~~~~~~~~^~~
../../Saxon.C.API/SaxonCGlue.c: In function ‘checkForException’:
../../Saxon.C.API/SaxonCGlue.c:133:50: warning: unused parameter ‘environii’ [-Wunused-parameter]
  133 | const char * checkForException(sxnc_environment *environii) {
      |                                ~~~~~~~~~~~~~~~~~~^~~~~~~~~
../../Saxon.C.API/SaxonCGlue.c: In function ‘setParameter’:
../../Saxon.C.API/SaxonCGlue.c:202:10: error: dangling pointer ‘parameters’ to ‘temp’ may be used [-Werror=dangling-pointer=]
  202 |         (*parameters)[(*parLen) - 1].value = value->xdmvalue;
      |         ~^~~~~~~~~~~~
../../Saxon.C.API/SaxonCGlue.c:190:33: note: ‘temp’ declared here
  190 |                 sxnc_parameter* temp = (sxnc_parameter*)malloc(sizeof(sxnc_parameter)*(*parCap));
      |                                 ^~~~
../../Saxon.C.API/SaxonCGlue.c:201:10: error: dangling pointer ‘parameters’ to ‘temp’ may be used [-Werror=dangling-pointer=]
  201 |         (*parameters)[(*parLen) - 1].name = (char*)newName;
      |         ~^~~~~~~~~~~~
../../Saxon.C.API/SaxonCGlue.c:190:33: note: ‘temp’ declared here
  190 |                 sxnc_parameter* temp = (sxnc_parameter*)malloc(sizeof(sxnc_parameter)*(*parCap));
      |                                 ^~~~
../../Saxon.C.API/SaxonCGlue.c: In function ‘setProperty’:
../../Saxon.C.API/SaxonCGlue.c:232:10: error: dangling pointer ‘properties’ to ‘temp’ may be used [-Werror=dangling-pointer=]
  232 |         (*properties)[(*propLen)].value = (char*)newValue;
      |         ~^~~~~~~~~~~~
../../Saxon.C.API/SaxonCGlue.c:217:32: note: ‘temp’ declared here
  217 |                 sxnc_property* temp = (sxnc_property*)malloc(sizeof(sxnc_property)*  (*propCap));
      |                                ^~~~
../../Saxon.C.API/SaxonCGlue.c:231:10: error: dangling pointer ‘properties’ to ‘temp’ may be used [-Werror=dangling-pointer=]
  231 |         (*properties)[(*propLen)].name = (char*)newName;
      |         ~^~~~~~~~~~~~
../../Saxon.C.API/SaxonCGlue.c:217:32: note: ‘temp’ declared here
  217 |                 sxnc_property* temp = (sxnc_property*)malloc(sizeof(sxnc_property)*  (*propCap));
      |

Do I have to add e.g. dangling-pointer to that variable TURN_ERRORS_TO_WARNINGS in the build64-linux.sh or what is the right way to get the C++ samples to compile and build?


Replies (2)

RE: Error on compilation attempt of SaxonC 12.2 HE with Debian 12.0 WSL - Added by O'Neil Delpratt over 1 year ago

Adding dangling-pointer to TURN_ERRORS_TO_WARNINGS s a work around since that bit of code is not used in the C++ API. I will create bug issue for this for the C API.

RE: Error on compilation attempt of SaxonC 12.2 HE with Debian 12.0 WSL - Added by Martin Honnen over 1 year ago

I can confirm that adding -Wno-error=dangling-pointer to the TURN_ERRORS_TO_WARNINGS variable allows me to build the C++ samples now on Debian 12.

    (1-2/2)

    Please register to reply