lxml fails to build against libxml2 2.12.1 and libxslt 1.1.39

Bug #2044786 reported by Twaik
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
lxml
Fix Released
Medium
scoder

Bug Description

pip3 install lxml reports
```
Collecting lxml
  Using cached lxml-4.9.3.tar.gz (3.6 MB)
  Preparing metadata (setup.py) ... done
Building wheels for collected packages: lxml
  Building wheel for lxml (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py bdist_wheel did not run successfully.
  │ exit code: 1
  ╰─> [174 lines of output]
      Building lxml version 4.9.3.
      /data/data/com.termux/files/usr/tmp/pip-install-dns92bfc/lxml_8be6a95f795443dcb76ce90a34da4f2c/setup.py:67: DeprecationWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html
        import pkg_resources
      Building without Cython.
      Building against libxml2 2.12.1 and libxslt 1.1.39
      Building against libxml2/libxslt in the following directory: /data/data/com.termux/files/usr/lib
      running bdist_wheel
      running build
      running build_py
      creating build
      creating build/lib.linux-aarch64-cpython-311
      creating build/lib.linux-aarch64-cpython-311/lxml
      copying src/lxml/ElementInclude.py -> build/lib.linux-aarch64-cpython-311/lxml
      copying src/lxml/__init__.py -> build/lib.linux-aarch64-cpython-311/lxml
      copying src/lxml/_elementpath.py -> build/lib.linux-aarch64-cpython-311/lxml
      copying src/lxml/builder.py -> build/lib.linux-aarch64-cpython-311/lxml
      copying src/lxml/cssselect.py -> build/lib.linux-aarch64-cpython-311/lxml
      copying src/lxml/doctestcompare.py -> build/lib.linux-aarch64-cpython-311/lxml
      copying src/lxml/pyclasslookup.py -> build/lib.linux-aarch64-cpython-311/lxml
      copying src/lxml/sax.py -> build/lib.linux-aarch64-cpython-311/lxml
      copying src/lxml/usedoctest.py -> build/lib.linux-aarch64-cpython-311/lxml
      creating build/lib.linux-aarch64-cpython-311/lxml/includes
      copying src/lxml/includes/__init__.py -> build/lib.linux-aarch64-cpython-311/lxml/includes
      creating build/lib.linux-aarch64-cpython-311/lxml/html
      copying src/lxml/html/ElementSoup.py -> build/lib.linux-aarch64-cpython-311/lxml/html
      copying src/lxml/html/__init__.py -> build/lib.linux-aarch64-cpython-311/lxml/html
      copying src/lxml/html/_diffcommand.py -> build/lib.linux-aarch64-cpython-311/lxml/html
      copying src/lxml/html/_html5builder.py -> build/lib.linux-aarch64-cpython-311/lxml/html
      copying src/lxml/html/_setmixin.py -> build/lib.linux-aarch64-cpython-311/lxml/html
      copying src/lxml/html/builder.py -> build/lib.linux-aarch64-cpython-311/lxml/html
      copying src/lxml/html/clean.py -> build/lib.linux-aarch64-cpython-311/lxml/html
      copying src/lxml/html/defs.py -> build/lib.linux-aarch64-cpython-311/lxml/html
      copying src/lxml/html/diff.py -> build/lib.linux-aarch64-cpython-311/lxml/html
      copying src/lxml/html/formfill.py -> build/lib.linux-aarch64-cpython-311/lxml/html
      copying src/lxml/html/html5parser.py -> build/lib.linux-aarch64-cpython-311/lxml/html
      copying src/lxml/html/soupparser.py -> build/lib.linux-aarch64-cpython-311/lxml/html
      copying src/lxml/html/usedoctest.py -> build/lib.linux-aarch64-cpython-311/lxml/html
      creating build/lib.linux-aarch64-cpython-311/lxml/isoschematron
      copying src/lxml/isoschematron/__init__.py -> build/lib.linux-aarch64-cpython-311/lxml/isoschematron
      copying src/lxml/etree.h -> build/lib.linux-aarch64-cpython-311/lxml
      copying src/lxml/etree_api.h -> build/lib.linux-aarch64-cpython-311/lxml
      copying src/lxml/lxml.etree.h -> build/lib.linux-aarch64-cpython-311/lxml
      copying src/lxml/lxml.etree_api.h -> build/lib.linux-aarch64-cpython-311/lxml
      copying src/lxml/etree.pyx -> build/lib.linux-aarch64-cpython-311/lxml
      copying src/lxml/objectify.pyx -> build/lib.linux-aarch64-cpython-311/lxml
      copying src/lxml/apihelpers.pxi -> build/lib.linux-aarch64-cpython-311/lxml
      copying src/lxml/classlookup.pxi -> build/lib.linux-aarch64-cpython-311/lxml
      copying src/lxml/cleanup.pxi -> build/lib.linux-aarch64-cpython-311/lxml
      copying src/lxml/debug.pxi -> build/lib.linux-aarch64-cpython-311/lxml
      copying src/lxml/docloader.pxi -> build/lib.linux-aarch64-cpython-311/lxml
      copying src/lxml/dtd.pxi -> build/lib.linux-aarch64-cpython-311/lxml
      copying src/lxml/extensions.pxi -> build/lib.linux-aarch64-cpython-311/lxml
      copying src/lxml/iterparse.pxi -> build/lib.linux-aarch64-cpython-311/lxml
      copying src/lxml/nsclasses.pxi -> build/lib.linux-aarch64-cpython-311/lxml
      copying src/lxml/objectpath.pxi -> build/lib.linux-aarch64-cpython-311/lxml
      copying src/lxml/parser.pxi -> build/lib.linux-aarch64-cpython-311/lxml
      copying src/lxml/parsertarget.pxi -> build/lib.linux-aarch64-cpython-311/lxml
      copying src/lxml/proxy.pxi -> build/lib.linux-aarch64-cpython-311/lxml
      copying src/lxml/public-api.pxi -> build/lib.linux-aarch64-cpython-311/lxml
      copying src/lxml/readonlytree.pxi -> build/lib.linux-aarch64-cpython-311/lxml
      copying src/lxml/relaxng.pxi -> build/lib.linux-aarch64-cpython-311/lxml
      copying src/lxml/saxparser.pxi -> build/lib.linux-aarch64-cpython-311/lxml
      copying src/lxml/schematron.pxi -> build/lib.linux-aarch64-cpython-311/lxml
      copying src/lxml/serializer.pxi -> build/lib.linux-aarch64-cpython-311/lxml
      copying src/lxml/xinclude.pxi -> build/lib.linux-aarch64-cpython-311/lxml
      copying src/lxml/xmlerror.pxi -> build/lib.linux-aarch64-cpython-311/lxml
      copying src/lxml/xmlid.pxi -> build/lib.linux-aarch64-cpython-311/lxml
      copying src/lxml/xmlschema.pxi -> build/lib.linux-aarch64-cpython-311/lxml
      copying src/lxml/xpath.pxi -> build/lib.linux-aarch64-cpython-311/lxml
      copying src/lxml/xslt.pxi -> build/lib.linux-aarch64-cpython-311/lxml
      copying src/lxml/xsltext.pxi -> build/lib.linux-aarch64-cpython-311/lxml
      copying src/lxml/includes/__init__.pxd -> build/lib.linux-aarch64-cpython-311/lxml/includes
      copying src/lxml/includes/c14n.pxd -> build/lib.linux-aarch64-cpython-311/lxml/includes
      copying src/lxml/includes/config.pxd -> build/lib.linux-aarch64-cpython-311/lxml/includes
      copying src/lxml/includes/dtdvalid.pxd -> build/lib.linux-aarch64-cpython-311/lxml/includes
      copying src/lxml/includes/etreepublic.pxd -> build/lib.linux-aarch64-cpython-311/lxml/includes
      copying src/lxml/includes/htmlparser.pxd -> build/lib.linux-aarch64-cpython-311/lxml/includes
      copying src/lxml/includes/relaxng.pxd -> build/lib.linux-aarch64-cpython-311/lxml/includes
      copying src/lxml/includes/schematron.pxd -> build/lib.linux-aarch64-cpython-311/lxml/includes
      copying src/lxml/includes/tree.pxd -> build/lib.linux-aarch64-cpython-311/lxml/includes
      copying src/lxml/includes/uri.pxd -> build/lib.linux-aarch64-cpython-311/lxml/includes
      copying src/lxml/includes/xinclude.pxd -> build/lib.linux-aarch64-cpython-311/lxml/includes
      copying src/lxml/includes/xmlerror.pxd -> build/lib.linux-aarch64-cpython-311/lxml/includes
      copying src/lxml/includes/xmlparser.pxd -> build/lib.linux-aarch64-cpython-311/lxml/includes
      copying src/lxml/includes/xmlschema.pxd -> build/lib.linux-aarch64-cpython-311/lxml/includes
      copying src/lxml/includes/xpath.pxd -> build/lib.linux-aarch64-cpython-311/lxml/includes
      copying src/lxml/includes/xslt.pxd -> build/lib.linux-aarch64-cpython-311/lxml/includes
      copying src/lxml/includes/etree_defs.h -> build/lib.linux-aarch64-cpython-311/lxml/includes
      copying src/lxml/includes/lxml-version.h -> build/lib.linux-aarch64-cpython-311/lxml/includes
      creating build/lib.linux-aarch64-cpython-311/lxml/isoschematron/resources
      creating build/lib.linux-aarch64-cpython-311/lxml/isoschematron/resources/rng
      copying src/lxml/isoschematron/resources/rng/iso-schematron.rng -> build/lib.linux-aarch64-cpython-311/lxml/isoschematron/resources/rng
      creating build/lib.linux-aarch64-cpython-311/lxml/isoschematron/resources/xsl
      copying src/lxml/isoschematron/resources/xsl/RNG2Schtrn.xsl -> build/lib.linux-aarch64-cpython-311/lxml/isoschematron/resources/xsl
      copying src/lxml/isoschematron/resources/xsl/XSD2Schtrn.xsl -> build/lib.linux-aarch64-cpython-311/lxml/isoschematron/resources/xsl
      creating build/lib.linux-aarch64-cpython-311/lxml/isoschematron/resources/xsl/iso-schematron-xslt1
      copying src/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_abstract_expand.xsl -> build/lib.linux-aarch64-cpython-311/lxml/isoschematron/resources/xsl/iso-schematron-xslt1
      copying src/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_dsdl_include.xsl -> build/lib.linux-aarch64-cpython-311/lxml/isoschematron/resources/xsl/iso-schematron-xslt1
      copying src/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_schematron_message.xsl -> build/lib.linux-aarch64-cpython-311/lxml/isoschematron/resources/xsl/iso-schematron-xslt1
      copying src/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_schematron_skeleton_for_xslt1.xsl -> build/lib.linux-aarch64-cpython-311/lxml/isoschematron/resources/xsl/iso-schematron-xslt1
      copying src/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_svrl_for_xslt1.xsl -> build/lib.linux-aarch64-cpython-311/lxml/isoschematron/resources/xsl/iso-schematron-xslt1
      copying src/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/readme.txt -> build/lib.linux-aarch64-cpython-311/lxml/isoschematron/resources/xsl/iso-schematron-xslt1
      running build_ext
      building 'lxml.etree' extension
      creating build/temp.linux-aarch64-cpython-311
      creating build/temp.linux-aarch64-cpython-311/src
      creating build/temp.linux-aarch64-cpython-311/src/lxml
      aarch64-linux-android-clang -DNDEBUG -g -fwrapv -O3 -Wall -fstack-protector-strong -O3 -fstack-protector-strong -O3 -fPIC -DCYTHON_CLINE_IN_TRACEBACK=0 -I/data/data/com.termux/files/usr/include/libxml2 -I/data/data/com.termux/files/usr/include -Isrc -Isrc/lxml/includes -I/data/data/com.termux/files/usr/include/python3.11 -c src/lxml/etree.c -o build/temp.linux-aarch64-cpython-311/src/lxml/etree.o -w
      src/lxml/etree.c:113152:38: error: incompatible function pointer types assigning to 'xmlStructuredErrorFunc' (aka 'void (*)(void *, const struct _xmlError *)') from 'void (void *, xmlError *)' (aka 'void (void *, struct _xmlError *)') [-Wincompatible-function-pointer-types]
       113152 | __pyx_v_self->_c_ctxt->sax->serror = __pyx_f_4lxml_5etree__receiveParserError;
              | ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      src/lxml/etree.c:117640:25: error: incompatible function pointer types assigning to 'xmlStructuredErrorFunc' (aka 'void (*)(void *, const struct _xmlError *)') from 'void (void *, xmlError *)' (aka 'void (void *, struct _xmlError *)') [-Wincompatible-function-pointer-types]
       117640 | __pyx_v_sax->serror = __pyx_f_4lxml_5etree__receiveParserError;
              | ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      src/lxml/etree.c:181724:28: error: incompatible function pointer types assigning to 'xmlStructuredErrorFunc' (aka 'void (*)(void *, const struct _xmlError *)') from 'void (void *, xmlError *)' (aka 'void (void *, struct _xmlError *)') [-Wincompatible-function-pointer-types]
       181724 | __pyx_v_xpathCtxt->error = __pyx_f_4lxml_5etree__receiveXPathError;
              | ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      src/lxml/etree.c:218998:60: error: incompatible function pointer types passing 'void (void *, xmlError *)' (aka 'void (void *, struct _xmlError *)') to parameter of type 'xmlStructuredErrorFunc' (aka 'void (*)(void *, const struct _xmlError *)') [-Wincompatible-function-pointer-types]
       218998 | xmlRelaxNGSetParserStructuredErrors(__pyx_v_parser_ctxt, __pyx_f_4lxml_5etree__receiveError, ((void *)__pyx_v_self->__pyx_base._error_log));
              | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      /data/data/com.termux/files/usr/include/libxml2/libxml/relaxng.h:155:30: note: passing argument to parameter 'serror' here
        155 | xmlStructuredErrorFunc serror,
            | ^
      src/lxml/etree.c:219416:60: error: incompatible function pointer types passing 'void (void *, xmlError *)' (aka 'void (void *, struct _xmlError *)') to parameter of type 'xmlStructuredErrorFunc' (aka 'void (*)(void *, const struct _xmlError *)') [-Wincompatible-function-pointer-types]
       219416 | xmlRelaxNGSetValidStructuredErrors(__pyx_v_valid_ctxt, __pyx_f_4lxml_5etree__receiveError, ((void *)__pyx_v_self->__pyx_base._error_log));
              | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      /data/data/com.termux/files/usr/include/libxml2/libxml/relaxng.h:184:31: note: passing argument to parameter 'serror' here
        184 | xmlStructuredErrorFunc serror, void *ctx);
            | ^
      src/lxml/etree.c:220305:59: error: incompatible function pointer types passing 'void (void *, xmlError *)' (aka 'void (void *, struct _xmlError *)') to parameter of type 'xmlStructuredErrorFunc' (aka 'void (*)(void *, const struct _xmlError *)') [-Wincompatible-function-pointer-types]
       220305 | xmlSchemaSetParserStructuredErrors(__pyx_v_parser_ctxt, __pyx_f_4lxml_5etree__receiveError, ((void *)__pyx_v_self->__pyx_base._error_log));
              | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      /data/data/com.termux/files/usr/include/libxml2/libxml/xmlschemas.h:156:30: note: passing argument to parameter 'serror' here
        156 | xmlStructuredErrorFunc serror,
            | ^
      src/lxml/etree.c:220848:59: error: incompatible function pointer types passing 'void (void *, xmlError *)' (aka 'void (void *, struct _xmlError *)') to parameter of type 'xmlStructuredErrorFunc' (aka 'void (*)(void *, const struct _xmlError *)') [-Wincompatible-function-pointer-types]
       220848 | xmlSchemaSetValidStructuredErrors(__pyx_v_valid_ctxt, __pyx_f_4lxml_5etree__receiveError, ((void *)__pyx_v_self->__pyx_base._error_log));
              | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      /data/data/com.termux/files/usr/include/libxml2/libxml/xmlschemas.h:185:30: note: passing argument to parameter 'serror' here
        185 | xmlStructuredErrorFunc serror,
            | ^
      src/lxml/etree.c:221613:66: error: incompatible function pointer types passing 'void (void *, xmlError *)' (aka 'void (void *, struct _xmlError *)') to parameter of type 'xmlStructuredErrorFunc' (aka 'void (*)(void *, const struct _xmlError *)') [-Wincompatible-function-pointer-types]
       221613 | xmlSchemaSetValidStructuredErrors(__pyx_v_self->_valid_ctxt, __pyx_f_4lxml_5etree__receiveError, ((void *)__pyx_v_error_log));
              | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      /data/data/com.termux/files/usr/include/libxml2/libxml/xmlschemas.h:185:30: note: passing argument to parameter 'serror' here
        185 | xmlStructuredErrorFunc serror,
            | ^
      src/lxml/etree.c:222790:63: error: incompatible function pointer types passing 'void (void *, xmlError *)' (aka 'void (void *, struct _xmlError *)') to parameter of type 'xmlStructuredErrorFunc' (aka 'void (*)(void *, const struct _xmlError *)') [-Wincompatible-function-pointer-types]
       222790 | xmlSchematronSetValidStructuredErrors(__pyx_v_valid_ctxt, __pyx_f_4lxml_5etree__receiveError, ((void *)__pyx_v_self->__pyx_base._error_log));
              | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      /data/data/com.termux/files/usr/include/libxml2/libxml/schematron.h:105:31: note: passing argument to parameter 'serror' here
        105 | xmlStructuredErrorFunc serror,
            | ^
      9 errors generated.
      Compile failed: command '/data/data/com.termux/files/usr/bin/aarch64-linux-android-clang' failed with exit code 1
      creating data
      creating data/data
      creating data/data/com.termux
      creating data/data/com.termux/files
      creating data/data/com.termux/files/usr
      creating data/data/com.termux/files/usr/tmp
      cc -I/data/data/com.termux/files/usr/include/libxml2 -I/data/data/com.termux/files/usr/include -I/usr/include/libxml2 -c /data/data/com.termux/files/usr/tmp/xmlXPathInitd09ks7k3.c -o data/data/com.termux/files/usr/tmp/xmlXPathInitd09ks7k3.o
      /data/data/com.termux/files/usr/tmp/xmlXPathInitd09ks7k3.c:3:5: warning: 'xmlXPathInit' is deprecated [-Wdeprecated-declarations]
          3 | xmlXPathInit();
            | ^
      /data/data/com.termux/files/usr/include/libxml2/libxml/xpath.h:562:1: note: 'xmlXPathInit' has been explicitly marked deprecated here
        562 | XML_DEPRECATED
            | ^
      /data/data/com.termux/files/usr/include/libxml2/libxml/xmlversion.h:447:43: note: expanded from macro 'XML_DEPRECATED'
        447 | # define XML_DEPRECATED __attribute__((deprecated))
            | ^
      1 warning generated.
      cc data/data/com.termux/files/usr/tmp/xmlXPathInitd09ks7k3.o -L/data/data/com.termux/files/usr/lib -lxml2 -o a.out
      error: command '/data/data/com.termux/files/usr/bin/aarch64-linux-android-clang' failed with exit code 1
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for lxml
  Running setup.py clean for lxml
Failed to build lxml
ERROR: Could not build wheels for lxml, which is required to install pyproject.toml-based projects
```

Twaik (twaik)
description: updated
Revision history for this message
scoder (scoder) wrote :

Thanks for the report. That is annoying, looks like they constified their API a bit more, leading to backward incompatibilities.

The problem is that adapting the code on lxml side would mean that you get the same error/warning with older libxml2 versions, so there is no clean way out. Changing the code to use 'const' might at least turn the error into a warning. We'll see. Maybe an explicit cast might help hiding it, although that always bares the risk of undetected future problems. Annoying, as I wrote…

Changed in lxml:
importance: Undecided → Medium
milestone: none → 5.0
status: New → Triaged
Revision history for this message
scoder (scoder) wrote :
Changed in lxml:
assignee: nobody → scoder (scoder)
status: Triaged → Fix Committed
scoder (scoder)
Changed in lxml:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.