Building the example harness (or any other harness) fails on systems with binutils-2.46 (see below). The reason seems to be the removal of FOR_EACH_DISASSEMBLER_OPTION from binutils version 2.46, which is used for calling disassembler() in a correct way. This is already fixed upstream.
$ cd example
$ cargo hfuzz build
Compiling honggfuzz v0.5.58 (/tmp/honggfuzz-rs)
error: failed to run custom build command for `honggfuzz v0.5.58 (/tmp/honggfuzz-rs)`
Caused by:
process didn't exit successfully: `/tmp/honggfuzz-rs/example/hfuzz_target/release/build/honggfuzz-d80db5e90e34a2bd/build-script-build` (exit status: 101)
--- stdout
make: Entering directory '/tmp/honggfuzz-rs/honggfuzz'
rm -f -r core Makefile.bak cmdline.o display.o fuzz.o honggfuzz.o input.o mangle.o report.o sanitizers.o socketfuzzer.o subproc.o linux/arch.o linux/bfd.o linux/perf.o linux/pt.o linux/trace.o linux/unwind.o honggfuzz hfuzz_cc/hfuzz-cc libhfuzz/libhfuzz.a libhfuzz/libhfuzz.so libhfuzz/fetch.o libhfuzz/instrument.o libhfuzz/linux.o libhfuzz/memorycmp.o libhfuzz/performance.o libhfuzz/persistent.o libhfcommon/libhfcommon.a libhfcommon/files.o libhfcommon/log.o libhfcommon/ns.o libhfcommon/util.o libhfnetdriver/libhfnetdriver.a libhfnetdriver/netdriver.o obj libs ./*.o ./*~ ./core ./*.a ./*.dSYM ./*.la ./*.so ./*.dylib linux/*.o linux/*~ linux/core linux/*.a linux/*.dSYM linux/*.la linux/*.so linux/*.dylib mac/*.o mac/*~ mac/core mac/*.a mac/*.dSYM mac/*.la mac/*.so mac/*.dylib netbsd/*.o netbsd/*~ netbsd/core netbsd/*.a netbsd/*.dSYM netbsd/*.la netbsd/*.so netbsd/*.dylib posix/*.o posix/*~ posix/core posix/*.a posix/*.dSYM posix/*.la posix/*.so posix/*.dylib libhfuzz/*.o libhfuzz/*~ libhfuzz/core libhfuzz/*.a libhfuzz/*.dSYM libhfuzz/*.la libhfuzz/*.so libhfuzz/*.dylib libhfcommon/*.o libhfcommon/*~ libhfcommon/core libhfcommon/*.a libhfcommon/*.dSYM libhfcommon/*.la libhfcommon/*.so libhfcommon/*.dylib libhfnetdriver/*.o libhfnetdriver/*~ libhfnetdriver/core libhfnetdriver/*.a libhfnetdriver/*.dSYM libhfnetdriver/*.la libhfnetdriver/*.so libhfnetdriver/*.dylib
make: Leaving directory '/tmp/honggfuzz-rs/honggfuzz'
make: Entering directory '/tmp/honggfuzz-rs/honggfuzz'
cc -c -O3 -mtune=native -funroll-loops -std=c11 -I/usr/local/include -D_GNU_SOURCE -Wall -Wextra -Werror -Wno-format-truncation -Wno-override-init -I. -D_FILE_OFFSET_BITS=64 -finline-limit=4000 -D_HF_ARCH_LINUX -D_HF_ARCH_LINUX -g -ggdb -g3 -o cmdline.o cmdline.c
cc -c -O3 -mtune=native -funroll-loops -std=c11 -I/usr/local/include -D_GNU_SOURCE -Wall -Wextra -Werror -Wno-format-truncation -Wno-override-init -I. -D_FILE_OFFSET_BITS=64 -finline-limit=4000 -D_HF_ARCH_LINUX -D_HF_ARCH_LINUX -g -ggdb -g3 -o display.o display.c
cc -c -O3 -mtune=native -funroll-loops -std=c11 -I/usr/local/include -D_GNU_SOURCE -Wall -Wextra -Werror -Wno-format-truncation -Wno-override-init -I. -D_FILE_OFFSET_BITS=64 -finline-limit=4000 -D_HF_ARCH_LINUX -D_HF_ARCH_LINUX -g -ggdb -g3 -o fuzz.o fuzz.c
cc -c -O3 -mtune=native -funroll-loops -std=c11 -I/usr/local/include -D_GNU_SOURCE -Wall -Wextra -Werror -Wno-format-truncation -Wno-override-init -I. -D_FILE_OFFSET_BITS=64 -finline-limit=4000 -D_HF_ARCH_LINUX -D_HF_ARCH_LINUX -g -ggdb -g3 -o honggfuzz.o honggfuzz.c
cc -c -O3 -mtune=native -funroll-loops -std=c11 -I/usr/local/include -D_GNU_SOURCE -Wall -Wextra -Werror -Wno-format-truncation -Wno-override-init -I. -D_FILE_OFFSET_BITS=64 -finline-limit=4000 -D_HF_ARCH_LINUX -D_HF_ARCH_LINUX -g -ggdb -g3 -o input.o input.c
cc -c -O3 -mtune=native -funroll-loops -std=c11 -I/usr/local/include -D_GNU_SOURCE -Wall -Wextra -Werror -Wno-format-truncation -Wno-override-init -I. -D_FILE_OFFSET_BITS=64 -finline-limit=4000 -D_HF_ARCH_LINUX -D_HF_ARCH_LINUX -g -ggdb -g3 -o mangle.o mangle.c
cc -c -O3 -mtune=native -funroll-loops -std=c11 -I/usr/local/include -D_GNU_SOURCE -Wall -Wextra -Werror -Wno-format-truncation -Wno-override-init -I. -D_FILE_OFFSET_BITS=64 -finline-limit=4000 -D_HF_ARCH_LINUX -D_HF_ARCH_LINUX -g -ggdb -g3 -o report.o report.c
cc -c -O3 -mtune=native -funroll-loops -std=c11 -I/usr/local/include -D_GNU_SOURCE -Wall -Wextra -Werror -Wno-format-truncation -Wno-override-init -I. -D_FILE_OFFSET_BITS=64 -finline-limit=4000 -D_HF_ARCH_LINUX -D_HF_ARCH_LINUX -g -ggdb -g3 -o sanitizers.o sanitizers.c
cc -c -O3 -mtune=native -funroll-loops -std=c11 -I/usr/local/include -D_GNU_SOURCE -Wall -Wextra -Werror -Wno-format-truncation -Wno-override-init -I. -D_FILE_OFFSET_BITS=64 -finline-limit=4000 -D_HF_ARCH_LINUX -D_HF_ARCH_LINUX -g -ggdb -g3 -o socketfuzzer.o socketfuzzer.c
cc -c -O3 -mtune=native -funroll-loops -std=c11 -I/usr/local/include -D_GNU_SOURCE -Wall -Wextra -Werror -Wno-format-truncation -Wno-override-init -I. -D_FILE_OFFSET_BITS=64 -finline-limit=4000 -D_HF_ARCH_LINUX -D_HF_ARCH_LINUX -g -ggdb -g3 -o subproc.o subproc.c
cc -c -O3 -mtune=native -funroll-loops -std=c11 -I/usr/local/include -D_GNU_SOURCE -Wall -Wextra -Werror -Wno-format-truncation -Wno-override-init -I. -D_FILE_OFFSET_BITS=64 -finline-limit=4000 -D_HF_ARCH_LINUX -D_HF_ARCH_LINUX -g -ggdb -g3 -o linux/arch.o linux/arch.c
cc -c -O3 -mtune=native -funroll-loops -std=c11 -I/usr/local/include -D_GNU_SOURCE -Wall -Wextra -Werror -Wno-format-truncation -Wno-override-init -I. -D_FILE_OFFSET_BITS=64 -finline-limit=4000 -D_HF_ARCH_LINUX -D_HF_ARCH_LINUX -g -ggdb -g3 -o linux/bfd.o linux/bfd.c
make: Leaving directory '/tmp/honggfuzz-rs/honggfuzz'
--- stderr
linux/bfd.c: In function ‘arch_bfdDisasm’:
linux/bfd.c:240:51: error: incompatible type for argument 1 of ‘disassembler’
240 | disassembler_ftype disassemble = disassembler(bfdh);
| ^~~~
| |
| bfd *
In file included from linux/bfd.c:29:
/usr/include/dis-asm.h:417:63: note: expected ‘enum bfd_architecture’ but argument is of type ‘bfd *’
417 | extern disassembler_ftype disassembler (enum bfd_architecture arc,
| ~~~~~~~~~~~~~~~~~~~~~~^~~
linux/bfd.c:240:38: error: too few arguments to function ‘disassembler’; expected 4, have 1
240 | disassembler_ftype disassemble = disassembler(bfdh);
| ^~~~~~~~~~~~
/usr/include/dis-asm.h:417:27: note: declared here
417 | extern disassembler_ftype disassembler (enum bfd_architecture arc,
| ^~~~~~~~~~~~
make: *** [Makefile:283: linux/bfd.o] Error 1
thread 'main' (17052) panicked at /tmp/honggfuzz-rs/build.rs:63:5:
assertion failed: status.success()
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Building the example harness (or any other harness) fails on systems with binutils-2.46 (see below). The reason seems to be the removal of
FOR_EACH_DISASSEMBLER_OPTIONfrom binutils version 2.46, which is used for callingdisassembler()in a correct way. This is already fixed upstream.