A quick summary how I installed AFL to fuzz libxml2 using an instrumented build and some glue code.
This is how it looked like to run the fuzzer on 16 cores in parallel:
apt update
apt full-upgrade
apt install build-essential autoconf libtool automake pkg-config -ywget https://lcamtuf.coredump.cx/afl/releases/afl-latest.tgz
tar xvzf afl-latest.tgz
rm afl-latest.tgz
cd afl-2.52b/
make
make install
cd ..wget https://gitlab.gnome.org/GNOME/libxml2/-/archive/v2.9.10/libxml2-v2.9.10.tar.gz
tar xvzf libxml2-v2.9.10.tar.gz
rm libxml2-v2.9.10.tar.gz
cd libxml2-v2.9.10/
mkdir output
./autogen.sh --without-python
CC=afl-gcc ./configure --prefix=$(pwd)/output
make clean all
make install
cd ..afl-g++ -I libxml2-v2.9.10/output/include/libxml2/ -L libxml2-v2.9.10/output/lib/ parse_xml_stdin.c -lm -lxml2 -o parse_xml_stdinmkdir -p testcases
mkdir -p findings
echo "<xml>te<st</xml>" > testcases/test.xml
afl-fuzz -i testcases/ -o findings/ -x afl-2.52b/dictionaries/xml.dict ./parse_xml_stdin