make fails on debian with fuzzers enabled
I'm trying to build poppler with fuzz testing enabled. I follow the instructions in INSTALL so I installed the extra cmake modules and I'm running the following commands:
mkdir build cd build cmake .. -DCMAKE_CXX_COMPILER=clang++ -DENABLE_FUZZER=ON -DECM_ENABLE_SANITIZERS='fuzzer;address' -DCMAKE_C_FLAGS='-fPIE' make
make fails with the following error:
/usr/bin/ld: CMakeFiles/pdftoppm.dir/pdftoppm.cc.o: in function `main': /usr/local/google/home/ceyhunalp/workspace/poppler/utils/pdftoppm.cc:369: multiple definition of `main'; /usr/lib/llvm-9/lib/clang/9.0.1/lib/linux/libclang_rt.fuzzer-x86_64.a(fuzzer.o):(.text.main+0x0): first defined here /usr/bin/ld: /usr/lib/llvm-9/lib/clang/9.0.1/lib/linux/libclang_rt.fuzzer-x86_64.a(fuzzer.o): in function `main': (.text.main+0x12): undefined reference to `LLVMFuzzerTestOneInput' clang: error: linker command failed with exit code 1 (use -v to see invocation) make: *** [utils/CMakeFiles/pdftoppm.dir/build.make:115: utils/pdftoppm] Error 1 make: *** [CMakeFiles/Makefile2:315: utils/CMakeFiles/pdftoppm.dir/all] Error 2 make: *** [Makefile:141: all] Error 2
I was able to work around this issue by running
make pdf_fuzzer instead but it would be good to understand why poppler fails. Any ideas?