Thread

  1. Make PostgreSQL work with newer libxml2.

    Xing Guo <higuoxing@gmail.com> — 2023-12-03T15:17:55Z

    Hi hackers,
    
    There is a breaking change of API since the v2.12.0 of libxml2[1][2]. My
    compiler complains about incompatible function signatures:
    
    
    /usr/bin/clang -Wall -Wmissing-prototypes -Wpointer-arith
    -Wdeclaration-after-statement -Werror=vla
    -Werror=unguarded-availability-new -Wendif-labels -Wmissing
    -format-attribute -Wcast-function-type -Wformat-security
    -fno-strict-aliasing -fwrapv -fexcess-precision=standard
    -Wno-unused-command-line-argument -Wno-compou
    nd-token-split-by-macro -Wno-cast-function-type-strict -g -Og -g3 -I. -I.
    -I../../../../src/include  -D_GNU_SOURCE -I/usr/include/libxml2   -c -o
    xml.o xml.c
    xml.c:1199:45: error: incompatible function pointer types passing 'void
    (void *, xmlErrorPtr)' (aka 'void (void *, struct _xmlError *)') to
    parameter of type '
    xmlStructuredErrorFunc' (aka 'void (*)(void *, const struct _xmlError *)')
    [-Wincompatible-function-pointer-types]
            xmlSetStructuredErrorFunc((void *) errcxt, xml_errorHandler);
                                                       ^~~~~~~~~~~~~~~~
    /usr/include/libxml2/libxml/xmlerror.h:898:29: note: passing argument to
    parameter 'handler' here
                                     xmlStructuredErrorFunc handler);
                                                            ^
    xml.c:4806:55: error: incompatible function pointer types passing 'void
    (void *, xmlErrorPtr)' (aka 'void (void *, struct _xmlError *)') to
    parameter of type '
    xmlStructuredErrorFunc' (aka 'void (*)(void *, const struct _xmlError *)')
    [-Wincompatible-function-pointer-types]
            xmlSetStructuredErrorFunc((void *) xtCxt->xmlerrcxt,
    xml_errorHandler);
    
     ^~~~~~~~~~~~~~~~
    /usr/include/libxml2/libxml/xmlerror.h:898:29: note: passing argument to
    parameter 'handler' here
                                     xmlStructuredErrorFunc handler);
                                                            ^
    xml.c:4860:55: error: incompatible function pointer types passing 'void
    (void *, xmlErrorPtr)' (aka 'void (void *, struct _xmlError *)') to
    parameter of type '
    xmlStructuredErrorFunc' (aka 'void (*)(void *, const struct _xmlError *)')
    [-Wincompatible-function-pointer-types]
            xmlSetStructuredErrorFunc((void *) xtCxt->xmlerrcxt,
    xml_errorHandler);
    
     ^~~~~~~~~~~~~~~~
    /usr/include/libxml2/libxml/xmlerror.h:898:29: note: passing argument to
    parameter 'handler' here
                                     xmlStructuredErrorFunc handler);
                                                            ^
    xml.c:5003:55: error: incompatible function pointer types passing 'void
    (void *, xmlErrorPtr)' (aka 'void (void *, struct _xmlError *)') to
    parameter of type '
    xmlStructuredErrorFunc' (aka 'void (*)(void *, const struct _xmlError *)')
    [-Wincompatible-function-pointer-types]
            xmlSetStructuredErrorFunc((void *) xtCxt->xmlerrcxt,
    xml_errorHandler);
    
     ^~~~~~~~~~~~~~~~
    /usr/include/libxml2/libxml/xmlerror.h:898:29: note: passing argument to
    parameter 'handler' here
                                     xmlStructuredErrorFunc handler);
                                                            ^
    4 errors generated.
    make[4]: *** [<builtin>: xml.o] Error 1
    
    
    Here is a quick workaround for it.
    
    [1]
    https://github.com/GNOME/libxml2/commit/61034116d0a3c8b295c6137956adc3ae55720711
    [2]
    https://github.com/GNOME/libxml2/commit/45470611b047db78106dcb2fdbd4164163c15ab7
    
    Best Regards,
    Xing