FTBFS with libxml2 2.11.4: error: 'xmlRecoverMemory' is deprecated
When building with libxml2 2.11.4 I got:
[6/73] Compiling C object src/common/libutil.a.p/pretty-print.c.o
FAILED: src/common/libutil.a.p/pretty-print.c.o
gcc -Isrc/common/libutil.a.p -Isrc/common -I../src/common -I. -I.. -I/nix/store/k1rfz8y5bgnwkr0y483k4mpy7k9v8p13-libxml2-2.11.4-dev/include/libxml2 -I/nix/store/dcwr090bqdp45z21cdzx6pngacch97mb-glib-2.76.4-dev/include -I/nix/store/dcwr090bqdp45z21cdzx6pngacch97mb-glib-2.76.4-dev/include/glib-2.0 -I/nix/store/prf7zgzc9067aiw9qy583pfrrj1s65ah-glib-2.76.4/lib/glib-2.0/include -I/nix/store/0m8cscz23scdlwqnydjlyg68xmlhj6k8-libsoup-3.4.2-dev/include/libsoup-3.0 -I/nix/store/m085g3rsqglgq79bg5332hsrd9b3j6d8-gupnp-1.6.4-dev/include/gupnp-1.6 -I/nix/store/78xbl7w8fg5y9zyva06hvlc406swb9z9-gssdp-1.6.2-dev/include/gssdp-1.6 -I/nix/store/2xm5rq23mqbsz00g719qymq6fcnpz3cr-gtk+3-3.24.38-dev/include/gtk-3.0 -I/nix/store/kry0a309dr7jm1y9vpkggl0pxpd1a2sc-at-spi2-core-2.48.3-dev/include/atk-1.0 -I/nix/store/sfw83wf115jb435rbqql9apmvd2l4y2i-cairo-1.16.0-dev/include/cairo -I/nix/store/0hmvklj0mbhrn8flwbcwivvkv45limhg-freetype-2.13.0-dev/include/freetype2 -I/nix/store/0hmvklj0mbhrn8flwbcwivvkv45limhg-freetype-2.13.0-dev/include -I/nix/store/wmgyp1frrsdszvwfc7vx7yr2wpbwbi61-gdk-pixbuf-2.42.10-dev/include/gdk-pixbuf-2.0 -I/nix/store/ygca8fpm6ad5wva2cx88kc56s5xyh13a-pango-1.50.14-dev/include/pango-1.0 -I/nix/store/0l5dw7qzvfwa25nkm5zggz4icb5iyqnz-harfbuzz-7.3.0-dev/include/harfbuzz -fdiagnostics-color=always -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Werror=deprecated-declarations -fPIC -pthread -MD -MQ src/common/libutil.a.p/pretty-print.c.o -MF src/common/libutil.a.p/pretty-print.c.o.d -o src/common/libutil.a.p/pretty-print.c.o -c ../src/common/pretty-print.c
../src/common/pretty-print.c: In function 'pretty_print_xml':
../src/common/pretty-print.c:37:9: error: 'xmlRecoverMemory' is deprecated [-Werror=deprecated-declarations]
37 | doc = xmlRecoverMemory (xml, strlen (xml));
| ^~~
In file included from /nix/store/k1rfz8y5bgnwkr0y483k4mpy7k9v8p13-libxml2-2.11.4-dev/include/libxml2/libxml/globals.h:18,
from /nix/store/k1rfz8y5bgnwkr0y483k4mpy7k9v8p13-libxml2-2.11.4-dev/include/libxml2/libxml/threads.h:35,
from /nix/store/k1rfz8y5bgnwkr0y483k4mpy7k9v8p13-libxml2-2.11.4-dev/include/libxml2/libxml/xmlmemory.h:222,
from /nix/store/k1rfz8y5bgnwkr0y483k4mpy7k9v8p13-libxml2-2.11.4-dev/include/libxml2/libxml/tree.h:1310,
from /nix/store/k1rfz8y5bgnwkr0y483k4mpy7k9v8p13-libxml2-2.11.4-dev/include/libxml2/libxml/xmlreader.h:14,
from ../src/common/pretty-print.c:25:
/nix/store/k1rfz8y5bgnwkr0y483k4mpy7k9v8p13-libxml2-2.11.4-dev/include/libxml2/libxml/parser.h:872:17: note: declared here
872 | xmlRecoverMemory (const char *buffer,
| ^~~~~~~~~~~~~~~~
cc1: some warnings being treated as errors
While we can unbreak the build with -Wno-error=deprecated-declarations
, I was looking at gupnp@80e68995 and wonder if we can just do that (i.e. use xmlReadMemory) here also (yes, replacing it with doc = xmlReadMemory (xml, strlen (xml), NULL, NULL, XML_PARSE_NONET | XML_PARSE_RECOVER);
seem to work for me).