Project

Profile

Help

error trying to build cppTests samples under Debian 12 (WSL)

Added by Martin Honnen about 1 year ago

When trying to compile the cppTests samples of SaxonC HE 12.4.1 under Debian 12 (WSL) with ./build64-linux.sh I get errors:

mh@LIBERTYDELL23:~/libsaxon-HEC-linux-amd64-v12.4.1/samples/cppTests$ ./build64-linux.sh
../../Saxon.C.API/SaxonCGlue.c: In function ‘detach_graalvm_thread’:
../../Saxon.C.API/SaxonCGlue.c:63:45: warning: unused parameter ‘env’ [-Wunused-parameter]
   63 | int detach_graalvm_thread(sxnc_environment *env) {
      |                           ~~~~~~~~~~~~~~~~~~^~~
../../Saxon.C.API/SaxonCGlue.c: In function ‘checkForException’:
../../Saxon.C.API/SaxonCGlue.c:106:49: warning: unused parameter ‘environii’ [-Wunused-parameter]
  106 | const char *checkForException(sxnc_environment *environii) { return 0; }
      |                               ~~~~~~~~~~~~~~~~~~^~~~~~~~~
../../Saxon.C.API/SaxonCGlue.c: In function ‘setParameter’:
../../Saxon.C.API/SaxonCGlue.c:167:4: error: dangling pointer ‘parameters’ to ‘temp’ may be used [-Werror=dangling-pointer=]
  167 |   (*parameters)[(*parLen) - 1].value = value->xdmvalue;
      |   ~^~~~~~~~~~~~
../../Saxon.C.API/SaxonCGlue.c:154:21: note: ‘temp’ declared here
  154 |     sxnc_parameter *temp =
      |                     ^~~~
../../Saxon.C.API/SaxonCGlue.c:166:4: error: dangling pointer ‘parameters’ to ‘temp’ may be used [-Werror=dangling-pointer=]
  166 |   (*parameters)[(*parLen) - 1].name = (char *)newName;
      |   ~^~~~~~~~~~~~
../../Saxon.C.API/SaxonCGlue.c:154:21: note: ‘temp’ declared here
  154 |     sxnc_parameter *temp =
      |                     ^~~~
../../Saxon.C.API/SaxonCGlue.c: In function ‘setProperty’:
../../Saxon.C.API/SaxonCGlue.c:196:4: error: dangling pointer ‘properties’ to ‘temp’ may be used [-Werror=dangling-pointer=]
  196 |   (*properties)[(*propLen)].value = (char *)newValue;
      |   ~^~~~~~~~~~~~
../../Saxon.C.API/SaxonCGlue.c:181:20: note: ‘temp’ declared here
  181 |     sxnc_property *temp =
      |                    ^~~~
../../Saxon.C.API/SaxonCGlue.c:195:4: error: dangling pointer ‘properties’ to ‘temp’ may be used [-Werror=dangling-pointer=]
  195 |   (*properties)[(*propLen)].name = (char *)newName;
      |   ~^~~~~~~~~~~~
../../Saxon.C.API/SaxonCGlue.c:181:20: note: ‘temp’ declared here
  181 |     sxnc_property *temp =
      |                    ^~~~
cc1: all warnings being treated as errors

Any idea what could be causing this and how to fix the build script for Debian 12?


Replies (5)

Please register to reply

RE: error trying to build cppTests samples under Debian 12 (WSL) - Added by Martin Honnen about 1 year ago

The C samples and the commands build and run fine under that same Debian system.

RE: error trying to build cppTests samples under Debian 12 (WSL) - Added by Martin Honnen about 1 year ago

Added -Wno-error=dangling-pointer to TURN_ERRORS_TO_WARNINGS in the build script, that way the samples build under Debian 12 and also then run fine, it appears.

error trying to build cppTests samples under Debian 12 (WSL) - Added by Norm Tovey-Walsh about 1 year ago

cc1: all warnings being treated as errors

This looks like the culprit. Does the cc1 parser running in that
environment treat warnings as errors by default? I assume there’s a
switch to turn that off.

(Longer term, it would be nice to resolve those warnings, but in the
short term…)

Be seeing you,
norm

--
Norm Tovey-Walsh
Saxonica

RE: error trying to build cppTests samples under Debian 12 (WSL) - Added by O'Neil Delpratt about 1 year ago

HI,

I agree, not good that you are getting the dangling pointer issue. This is specific to the C API and not the C++ API. Therefore your workaround to turn these errors to warnings is fine. I have created the bug issue #6301 so that we can address the problem for the longer term.

Thanks.

RE: error trying to build cppTests samples under Debian 12 (WSL) - Added by O'Neil Delpratt 12 months ago

Just to report that I have fixed this dangling pointer issue on the C API, which was causing compile errors in the C++ API on some linux distributions.

    (1-5/5)

    Please register to reply