cellml/libcellml

Various errors when trying to use libxml2 2.12

Closed this issue · 1 comments

agarny commented

I normally use libxml2 2.9.13 and 2.9.14 and it's fine, but I have just tried to build libCellML with libxml2 2.12.0 and got the following errors:

-- The CXX compiler identification is Clang 17.0.5
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /opt/homebrew/opt/llvm/bin/clang++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Performing Test UNDEFINED_SYMBOLS_ALLOWED - ...
-- Performing Test UNDEFINED_SYMBOLS_ALLOWED - Failed
-- Found Python: /Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/bin/python3.9 (found version "3.9.6") found components: Interpreter Development Development.Module Development.Embed
-- Performing Test HAVE_COVERAGE
-- Performing Test HAVE_COVERAGE - Success
-- Found Doxygen: /Users/Alan/bin/doxygen (found version "1.9.3") found components: doxygen missing components: dot
-- Found Sphinx: /opt/homebrew/opt/sphinx-doc/bin/sphinx-build
-- Found SWIG: /opt/homebrew/bin/swig (found suitable version "4.1.1", minimum required is "3")
-- Performing Test LLVM_COVERAGE_COMPILER_FLAGS_OK
-- Performing Test LLVM_COVERAGE_COMPILER_FLAGS_OK - Success
-- Performing Test GCC_COVERAGE_COMPILER_FLAGS_OK
-- Performing Test GCC_COVERAGE_COMPILER_FLAGS_OK - Success
-- Performing Test Iconv_IS_BUILT_IN
-- Performing Test Iconv_IS_BUILT_IN - Failed
-- Found LibXml2: /opt/homebrew/opt/libxml2/lib/libxml2.dylib (found version "2.12.0")
-- Found ZLIB: /Library/Developer/CommandLineTools/SDKs/MacOSX14.0.sdk/usr/lib/libz.tbd (found version "1.2.12")
-- Performing Test COMPILER_HAS_HIDDEN_VISIBILITY
-- Performing Test COMPILER_HAS_HIDDEN_VISIBILITY - Success
-- Performing Test COMPILER_HAS_HIDDEN_INLINE_VISIBILITY
-- Performing Test COMPILER_HAS_HIDDEN_INLINE_VISIBILITY - Success
-- Performing Test COMPILER_HAS_DEPRECATED_ATTR
-- Performing Test COMPILER_HAS_DEPRECATED_ATTR - Success
-- The C compiler identification is Clang 17.0.5
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /opt/homebrew/opt/llvm/bin/clang - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Found Threads: TRUE
-- Configuring done (2.0s)
-- Generating done (0.1s)
-- Build files have been written to: /Users/Alan/libCellML/build
[59/257] Building CXX object src/CMakeFiles/cellml.dir/xmlnode.cpp.o
FAILED: src/CMakeFiles/cellml.dir/xmlnode.cpp.o
/usr/local/bin/buildcache /opt/homebrew/opt/llvm/bin/clang++ -Dcellml_EXPORTS -I/Users/Alan/libCellML/build/src/api -I/Users/Alan/libCellML/src/api -I/Users/Alan/libCellML/src/api/libcellml/module -I/Users/Alan/libCellML/build/src -I/opt/homebrew/opt/libxml2/include/libxml2 -g -arch arm64 -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX14.0.sdk -mmacosx-version-min=10.15 -fPIC -fvisibility=hidden -fvisibility-inlines-hidden -fprofile-arcs -ftest-coverage -fprofile-instr-generate -fcoverage-mapping -Wall -W -Werror -MD -MT src/CMakeFiles/cellml.dir/xmlnode.cpp.o -MF src/CMakeFiles/cellml.dir/xmlnode.cpp.o.d -o src/CMakeFiles/cellml.dir/xmlnode.cpp.o -c /Users/Alan/libCellML/src/xmlnode.cpp
/Users/Alan/libCellML/src/xmlnode.cpp:313:5: error: use of undeclared identifier 'xmlKeepBlanksDefault'
  313 |     xmlKeepBlanksDefault(1);
      |     ^
1 error generated.
[62/257] Building CXX object src/CMakeFiles/cellml.dir/xmldoc.cpp.o
FAILED: src/CMakeFiles/cellml.dir/xmldoc.cpp.o
/usr/local/bin/buildcache /opt/homebrew/opt/llvm/bin/clang++ -Dcellml_EXPORTS -I/Users/Alan/libCellML/build/src/api -I/Users/Alan/libCellML/src/api -I/Users/Alan/libCellML/src/api/libcellml/module -I/Users/Alan/libCellML/build/src -I/opt/homebrew/opt/libxml2/include/libxml2 -g -arch arm64 -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX14.0.sdk -mmacosx-version-min=10.15 -fPIC -fvisibility=hidden -fvisibility-inlines-hidden -fprofile-arcs -ftest-coverage -fprofile-instr-generate -fcoverage-mapping -Wall -W -Werror -MD -MT src/CMakeFiles/cellml.dir/xmldoc.cpp.o -MF src/CMakeFiles/cellml.dir/xmldoc.cpp.o.d -o src/CMakeFiles/cellml.dir/xmldoc.cpp.o -c /Users/Alan/libCellML/src/xmldoc.cpp
/Users/Alan/libCellML/src/xmldoc.cpp:51:50: error: member access into incomplete type 'xmlParserCtxt' (aka '_xmlParserCtxt')
   51 |     auto doc = reinterpret_cast<XmlDoc *>(context->_private);
      |                                                  ^
/opt/homebrew/opt/libxml2/include/libxml2/libxml/tree.h:40:16: note: forward declaration of '_xmlParserCtxt'
   40 | typedef struct _xmlParserCtxt xmlParserCtxt;
      |                ^
/Users/Alan/libCellML/src/xmldoc.cpp:84:5: error: use of undeclared identifier 'xmlInitParser'
   84 |     xmlInitParser();
      |     ^
/Users/Alan/libCellML/src/xmldoc.cpp:85:32: error: use of undeclared identifier 'xmlNewParserCtxt'; did you mean 'xmlParserCtxt'?
   85 |     xmlParserCtxtPtr context = xmlNewParserCtxt();
      |                                ^
/opt/homebrew/opt/libxml2/include/libxml2/libxml/tree.h:40:31: note: 'xmlParserCtxt' declared here
   40 | typedef struct _xmlParserCtxt xmlParserCtxt;
      |                               ^
/Users/Alan/libCellML/src/xmldoc.cpp:86:12: error: member access into incomplete type 'xmlParserCtxt' (aka '_xmlParserCtxt')
   86 |     context->_private = reinterpret_cast<void *>(this);
      |            ^
/opt/homebrew/opt/libxml2/include/libxml2/libxml/tree.h:40:16: note: forward declaration of '_xmlParserCtxt'
   40 | typedef struct _xmlParserCtxt xmlParserCtxt;
      |                ^
/Users/Alan/libCellML/src/xmldoc.cpp:87:5: error: no matching function for call to 'xmlSetStructuredErrorFunc'
   87 |     xmlSetStructuredErrorFunc(context, structuredErrorCallback);
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~
/opt/homebrew/opt/libxml2/include/libxml2/libxml/xmlerror.h:897:5: note: candidate function not viable: no known conversion from 'void (void *, xmlErrorPtr)' (aka 'void (void *, _xmlError *)') to 'xmlStructuredErrorFunc' (aka 'void (*)(void *, const _xmlError *)') for 2nd argument
  897 |     xmlSetStructuredErrorFunc   (void *ctx,
      |     ^
  898 |                                  xmlStructuredErrorFunc handler);
      |                                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/Alan/libCellML/src/xmldoc.cpp:88:26: error: use of undeclared identifier 'xmlCtxtReadDoc'
   88 |     mPimpl->mXmlDocPtr = xmlCtxtReadDoc(context, reinterpret_cast<const xmlChar *>(input.c_str()), "/", nullptr, 0);
      |                          ^
/Users/Alan/libCellML/src/xmldoc.cpp:89:5: error: use of undeclared identifier 'xmlFreeParserCtxt'; did you mean 'xmlParserCtxt'?
   89 |     xmlFreeParserCtxt(context);
      |     ^
/opt/homebrew/opt/libxml2/include/libxml2/libxml/tree.h:40:31: note: 'xmlParserCtxt' declared here
   40 | typedef struct _xmlParserCtxt xmlParserCtxt;
      |                               ^
/Users/Alan/libCellML/src/xmldoc.cpp:91:5: error: use of undeclared identifier 'xmlCleanupParser'
   91 |     xmlCleanupParser();
      |     ^
/Users/Alan/libCellML/src/xmldoc.cpp:92:5: error: use of undeclared identifier 'xmlCleanupGlobals'
   92 |     xmlCleanupGlobals();
      |     ^
/Users/Alan/libCellML/src/xmldoc.cpp:119:5: error: use of undeclared identifier 'xmlInitParser'
  119 |     xmlInitParser();
      |     ^
/Users/Alan/libCellML/src/xmldoc.cpp:120:32: error: use of undeclared identifier 'xmlNewParserCtxt'; did you mean 'xmlParserCtxt'?
  120 |     xmlParserCtxtPtr context = xmlNewParserCtxt();
      |                                ^
/opt/homebrew/opt/libxml2/include/libxml2/libxml/tree.h:40:31: note: 'xmlParserCtxt' declared here
   40 | typedef struct _xmlParserCtxt xmlParserCtxt;
      |                               ^
/Users/Alan/libCellML/src/xmldoc.cpp:121:12: error: member access into incomplete type 'xmlParserCtxt' (aka '_xmlParserCtxt')
  121 |     context->_private = reinterpret_cast<void *>(this);
      |            ^
/opt/homebrew/opt/libxml2/include/libxml2/libxml/tree.h:40:16: note: forward declaration of '_xmlParserCtxt'
   40 | typedef struct _xmlParserCtxt xmlParserCtxt;
      |                ^
/Users/Alan/libCellML/src/xmldoc.cpp:122:5: error: no matching function for call to 'xmlSetStructuredErrorFunc'
  122 |     xmlSetStructuredErrorFunc(context, structuredErrorCallback);
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~
/opt/homebrew/opt/libxml2/include/libxml2/libxml/xmlerror.h:897:5: note: candidate function not viable: no known conversion from 'void (void *, xmlErrorPtr)' (aka 'void (void *, _xmlError *)') to 'xmlStructuredErrorFunc' (aka 'void (*)(void *, const _xmlError *)') for 2nd argument
  897 |     xmlSetStructuredErrorFunc   (void *ctx,
      |     ^
  898 |                                  xmlStructuredErrorFunc handler);
      |                                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/Alan/libCellML/src/xmldoc.cpp:123:26: error: use of undeclared identifier 'xmlCtxtReadDoc'
  123 |     mPimpl->mXmlDocPtr = xmlCtxtReadDoc(context, reinterpret_cast<const xmlChar *>(input.c_str()), "/", nullptr, 0);
      |                          ^
/Users/Alan/libCellML/src/xmldoc.cpp:124:143: error: use of undeclared identifier 'XML_CHAR_ENCODING_ASCII'
  124 |     xmlParserInputBufferPtr buf = xmlParserInputBufferCreateMem(reinterpret_cast<const char *>(mathMLDTD.c_str()), sizeMathmlDTDUncompressed, XML_CHAR_ENCODING_ASCII);
      |                                                                                                                                               ^
/Users/Alan/libCellML/src/xmldoc.cpp:125:49: error: use of undeclared identifier 'XML_CHAR_ENCODING_ASCII'
  125 |     xmlDtdPtr dtd = xmlIOParseDTD(nullptr, buf, XML_CHAR_ENCODING_ASCII);
      |                                                 ^
/Users/Alan/libCellML/src/xmldoc.cpp:126:29: error: member access into incomplete type 'xmlParserCtxt' (aka '_xmlParserCtxt')
  126 |     xmlValidateDtd(&(context->vctxt), mPimpl->mXmlDocPtr, dtd);
      |                             ^
/opt/homebrew/opt/libxml2/include/libxml2/libxml/tree.h:40:16: note: forward declaration of '_xmlParserCtxt'
   40 | typedef struct _xmlParserCtxt xmlParserCtxt;
      |                ^
/Users/Alan/libCellML/src/xmldoc.cpp:129:5: error: use of undeclared identifier 'xmlFreeParserCtxt'; did you mean 'xmlParserCtxt'?
  129 |     xmlFreeParserCtxt(context);
      |     ^
/opt/homebrew/opt/libxml2/include/libxml2/libxml/tree.h:40:31: note: 'xmlParserCtxt' declared here
   40 | typedef struct _xmlParserCtxt xmlParserCtxt;
      |                               ^
/Users/Alan/libCellML/src/xmldoc.cpp:131:5: error: use of undeclared identifier 'xmlCleanupParser'
  131 |     xmlCleanupParser();
      |     ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
[66/257] Building CXX object src/CMakeFiles/cellml.dir/printer.cpp.o
FAILED: src/CMakeFiles/cellml.dir/printer.cpp.o
/usr/local/bin/buildcache /opt/homebrew/opt/llvm/bin/clang++ -Dcellml_EXPORTS -I/Users/Alan/libCellML/build/src/api -I/Users/Alan/libCellML/src/api -I/Users/Alan/libCellML/src/api/libcellml/module -I/Users/Alan/libCellML/build/src -I/opt/homebrew/opt/libxml2/include/libxml2 -g -arch arm64 -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX14.0.sdk -mmacosx-version-min=10.15 -fPIC -fvisibility=hidden -fvisibility-inlines-hidden -fprofile-arcs -ftest-coverage -fprofile-instr-generate -fcoverage-mapping -Wall -W -Werror -MD -MT src/CMakeFiles/cellml.dir/printer.cpp.o -MF src/CMakeFiles/cellml.dir/printer.cpp.o.d -o src/CMakeFiles/cellml.dir/printer.cpp.o -c /Users/Alan/libCellML/src/printer.cpp
/Users/Alan/libCellML/src/printer.cpp:143:5: error: use of undeclared identifier 'xmlKeepBlanksDefault'
  143 |     xmlKeepBlanksDefault(0);
      |     ^
/Users/Alan/libCellML/src/printer.cpp:595:5: error: use of undeclared identifier 'xmlKeepBlanksDefault'
  595 |     xmlKeepBlanksDefault(0);
      |     ^
2 errors generated.
[72/257] Building CXX object tests/CMakeFiles/test_parser.dir/parser/libxml_user.cpp.o
FAILED: tests/CMakeFiles/test_parser.dir/parser/libxml_user.cpp.o
/usr/local/bin/buildcache /opt/homebrew/opt/llvm/bin/clang++  -I/Users/Alan/libCellML/build/tests -I/Users/Alan/libCellML/tests -I/Users/Alan/libCellML/build/src/api -I/Users/Alan/libCellML/src/api -I/Users/Alan/libCellML/src/api/libcellml/module -I/opt/homebrew/opt/libxml2/include/libxml2 -I/Users/Alan/libCellML/tests/gtest/include -g -arch arm64 -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX14.0.sdk -mmacosx-version-min=10.15 -Wall -W -Werror -MD -MT tests/CMakeFiles/test_parser.dir/parser/libxml_user.cpp.o -MF tests/CMakeFiles/test_parser.dir/parser/libxml_user.cpp.o.d -o tests/CMakeFiles/test_parser.dir/parser/libxml_user.cpp.o -c /Users/Alan/libCellML/tests/parser/libxml_user.cpp
/Users/Alan/libCellML/tests/parser/libxml_user.cpp:50:5: error: no matching function for call to 'xmlSetStructuredErrorFunc'
   50 |     xmlSetStructuredErrorFunc(context, structuredErrorCallback);
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~
/opt/homebrew/opt/libxml2/include/libxml2/libxml/xmlerror.h:897:5: note: candidate function not viable: no known conversion from 'void (void *, xmlErrorPtr)' (aka 'void (void *, _xmlError *)') to 'xmlStructuredErrorFunc' (aka 'void (*)(void *, const _xmlError *)') for 2nd argument
  897 |     xmlSetStructuredErrorFunc   (void *ctx,
      |     ^
  898 |                                  xmlStructuredErrorFunc handler);
      |                                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/Alan/libCellML/tests/parser/libxml_user.cpp:57:5: error: use of undeclared identifier 'xmlCleanupGlobals'; did you mean 'xmlCleanupThreads'?
   57 |     xmlCleanupGlobals();
      |     ^~~~~~~~~~~~~~~~~
      |     xmlCleanupThreads
/opt/homebrew/opt/libxml2/include/libxml2/libxml/threads.h:71:4: note: 'xmlCleanupThreads' declared here
   71 |                         xmlCleanupThreads(void);
      |                         ^
/Users/Alan/libCellML/tests/parser/libxml_user.cpp:57:5: error: 'xmlCleanupThreads' is deprecated [-Werror,-Wdeprecated-declarations]
   57 |     xmlCleanupGlobals();
      |     ^
/opt/homebrew/opt/libxml2/include/libxml2/libxml/threads.h:69:1: note: 'xmlCleanupThreads' has been explicitly marked deprecated here
   69 | XML_DEPRECATED
      | ^
/opt/homebrew/opt/libxml2/include/libxml2/libxml/xmlversion.h:447:43: note: expanded from macro 'XML_DEPRECATED'
  447 | #    define XML_DEPRECATED __attribute__((deprecated))
      |                                           ^
/Users/Alan/libCellML/tests/parser/libxml_user.cpp:74:5: error: no matching function for call to 'xmlSetStructuredErrorFunc'
   74 |     xmlSetStructuredErrorFunc(context, structuredErrorCallback);
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~
/opt/homebrew/opt/libxml2/include/libxml2/libxml/xmlerror.h:897:5: note: candidate function not viable: no known conversion from 'void (void *, xmlErrorPtr)' (aka 'void (void *, _xmlError *)') to 'xmlStructuredErrorFunc' (aka 'void (*)(void *, const _xmlError *)') for 2nd argument
  897 |     xmlSetStructuredErrorFunc   (void *ctx,
      |     ^
  898 |                                  xmlStructuredErrorFunc handler);
      |                                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/Alan/libCellML/tests/parser/libxml_user.cpp:79:5: error: use of undeclared identifier 'xmlCleanupGlobals'; did you mean 'xmlCleanupThreads'?
   79 |     xmlCleanupGlobals();
      |     ^~~~~~~~~~~~~~~~~
      |     xmlCleanupThreads
/opt/homebrew/opt/libxml2/include/libxml2/libxml/threads.h:71:4: note: 'xmlCleanupThreads' declared here
   71 |                         xmlCleanupThreads(void);
      |                         ^
/Users/Alan/libCellML/tests/parser/libxml_user.cpp:79:5: error: 'xmlCleanupThreads' is deprecated [-Werror,-Wdeprecated-declarations]
   79 |     xmlCleanupGlobals();
      |     ^
/opt/homebrew/opt/libxml2/include/libxml2/libxml/threads.h:69:1: note: 'xmlCleanupThreads' has been explicitly marked deprecated here
   69 | XML_DEPRECATED
      | ^
/opt/homebrew/opt/libxml2/include/libxml2/libxml/xmlversion.h:447:43: note: expanded from macro 'XML_DEPRECATED'
  447 | #    define XML_DEPRECATED __attribute__((deprecated))
      |                                           ^
6 errors generated.
ninja: build stopped: subcommand failed.

No idea why, but #1237 works fine on Linux and macOS, but not on Windows. I know that they may use different version of libxml2, but still it ought to be fine. Anyway, although I was able to build libCellML with libxml2 2.12.7 as part of libOpenCOR, in my libCellML-related tests I get unknown file: error: SEH exception with code 0xc0000005 thrown in the test body. as soon as I try to use libCellML. So, I am giving up (can't afford to spend more time on this) and going to stick to libxml2 2.9.14 (FWIW, libxml2 2.10.4 also works fine, but not libxml2 2.11.8 which gives the same error as libxml2 2.12.7).