openSUSE / libzypp

ZYpp Package Management library
http://doc.opensuse.org/projects/libzypp/HEAD/
Other
116 stars 82 forks source link

Not compile with new libxml 2.12.X #505

Closed AngryPenguinPL closed 10 months ago

AngryPenguinPL commented 11 months ago

After upgrading libxml to series 2.12.X libzypp no longer compile.

 FAILED: zypp/CMakeFiles/zypp-objlib.dir/parser/xml/Reader.cc.o 
DEBUG util.py:448:  /usr/bin/c++ -DENABLE_ZCHUNK_COMPRESSION=1 -DEXPORT_EXPERIMENTAL_API -DHAVE_PIPE2 -DHAVE_RPM_VERIFY_TRANSACTION_STEP -DHAVE_UDEV -DWITH_LIBPROXY_SUPPORT -DZYPP_DLL -DZYPP_RPM_BINARY=\"/usr/libexec/zypp/zypp-rpm\" -DZYPP_WORKER_PATH=\"/usr/libexec/zypp/workers\" -D_FILE_OFFSET_BITS=64 -I/builddir/build/BUILD/libzypp-17.31.25 -I/builddir/build/BUILD/libzypp-17.31.25/build -I/usr/include/rpm -I/usr/include/libxml2 -I/usr/include/sigc++-2.0 -I/usr/lib64/sigc++-2.0/include -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/builddir/build/BUILD/libzypp-17.31.25/build/zypp -I/builddir/build/BUILD/libzypp-17.31.25/build/zypp/sywu/include -I/builddir/build/BUILD/libzypp-17.31.25/libs/zypp-core -Os -fomit-frame-pointer -g3 -gdwarf-4 -Wstrict-aliasing=2 -pipe -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -fstack-protector-all --param=ssp-buffer-size=4 -m64 -mtune=generic -flto -DPROTOBUF_USE_DLLS -pthread -fno-strict-aliasing -fPIC -g -Wall -Wp,-D_GLIBCXX_ASSERTIONS -fvisibility-inlines-hidden -Woverloaded-virtual -Wnon-virtual-dtor -Werror=format-security -I/usr/include -Os -fomit-frame-pointer -g3 -gdwarf-4 -Wstrict-aliasing=2 -pipe -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -fstack-protector-all --param=ssp-buffer-size=4 -m64 -mtune=generic -flto -DPROTOBUF_USE_DLLS -std=c++17 -DZYPP_BASE_LOGGER_LOGGROUP=\"zypp\" -MD -MT zypp/CMakeFiles/zypp-objlib.dir/parser/xml/Reader.cc.o -MF zypp/CMakeFiles/zypp-objlib.dir/parser/xml/Reader.cc.o.d -o zypp/CMakeFiles/zypp-objlib.dir/parser/xml/Reader.cc.o -c /builddir/build/BUILD/libzypp-17.31.25/zypp/parser/xml/Reader.cc
DEBUG util.py:448:  /builddir/build/BUILD/libzypp-17.31.25/zypp/parser/xml/Reader.cc:119:7: error: no matching function for call to 'xmlTextReaderSetStructuredErrorHandler'
DEBUG util.py:448:    119 |       xmlTextReaderSetStructuredErrorHandler( _reader, structuredErrorFunc, NULL );
DEBUG util.py:448:        |       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
DEBUG util.py:448:  /usr/include/libxml2/libxml/xmlreader.h:419:6: 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
DEBUG util.py:448:    419 |             xmlTextReaderSetStructuredErrorHandler(xmlTextReaderPtr reader,
DEBUG util.py:448:        |             ^
DEBUG util.py:448:    420 |                                                    xmlStructuredErrorFunc f,
DEBUG util.py:448:        |                                                    ~~~~~~~~~~~~~~~~~~~~~~~~

Full build log: https://file-store.openmandriva.org/api/v1/file_stores/4572313c6dd54dbf32c4a91a01cbd9bd804545ed.log?show=true

Details:

mlandres commented 11 months ago

I've got no libxml 2.12. at hand, but according to the error message f80aaa4b94c9badb117308bd4032d6e2b2365627 could fix it.

AngryPenguinPL commented 11 months ago

Unfortunately, after applying this commit, I still have the following error:

  /builddir/build/BUILD/libzypp-17.31.25/zypp/parser/xml/Reader.cc:119:7: error: no matching function for call to 'xmlTextReaderSetStructuredErrorHandler'
DEBUG util.py:448:    119 |       xmlTextReaderSetStructuredErrorHandler( _reader, structuredErrorFunc, NULL );
DEBUG util.py:448:        |       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
DEBUG util.py:448:  /usr/include/libxml2/libxml/xmlreader.h:419:6: note: candidate function not viable: no known conversion from 'void (void *, const xmlErrorPtr)' (aka 'void (void *, _xmlError *const)') to 'xmlStructuredErrorFunc' (aka 'void (*)(void *, const _xmlError *)') for 2nd argument
DEBUG util.py:448:    419 |             xmlTextReaderSetStructuredErrorHandler(xmlTextReaderPtr reader,
DEBUG util.py:448:        |             ^
DEBUG util.py:448:    420 |                                                    xmlStructuredErrorFunc f,
DEBUG util.py:448:        |                                                    ~~~~~~~~~~~~~~~~~~~~~~~~
DEBUG util.py:448:  1 error generated.
berolinux commented 11 months ago

The fix doesn't work because const xmlErrorPtr makes it a constant pointer to a potentially non-const variable while libxml2 expects to get a pointer to a constant variable. There's probably a nicer way, but changing const xmlErrorPtr to const _xmlError * fixes it.

mlandres commented 10 months ago

@berolinux You're right of course. Unfortunately there's no signature which satisfies both (old and new). So your fix will not work with the old libxml.

error: invalid conversion from ‘void (*)(void*, const xmlError*)’ to ‘Told {aka void (*)(void*, xmlError*)}’ [-fpermissive]
error: invalid conversion from ‘void (*)(void*, xmlError*)’ to ‘Tnew {aka void (*)(void*, const xmlError*)}’ [-fpermissive]

We'll need an #ifdef regarding th libxml version which introduced the change.

mlandres commented 10 months ago

libzypp-17.31.28