Building the fuzzer library

I decided to try out the fuzzer library and clang-fuzzer, but it doesn't
seem to build for me. From the cmake files, I was pretty sure all I need
to do is set -DLLVM_USE_SANITIZE_COVERAGE=ON, but with this I get a
number of link errors for "lib/Fuzzer/test/LLVMFuzzer-CounterTest", for
example:

  lib/libLLVMFuzzer.a(FuzzerLoop.cpp.o): In function `SetDeathCallback':
  /home/bogner/code/llvm/lib/Fuzzer/FuzzerLoop.cpp:31: undefined reference to `__sanitizer_set_death_callback'
  lib/libLLVMFuzzer.a(FuzzerLoop.cpp.o): In function `fuzzer::Fuzzer::SetDeathCallback()':
  /home/bogner/code/llvm/lib/Fuzzer/FuzzerLoop.cpp:31: undefined reference to `__sanitizer_set_death_callback'
  lib/libLLVMFuzzer.a(FuzzerLoop.cpp.o): In function `RunOneMaximizeFullCoverageSet':
  /home/bogner/code/llvm/lib/Fuzzer/FuzzerLoop.cpp:236: undefined reference to `__sanitizer_reset_coverage'
  /home/bogner/code/llvm/lib/Fuzzer/FuzzerLoop.cpp:239: undefined reference to `__sanitizer_get_coverage_guards'

Is there something I'm missing? Has this broken recently? Is there
something wrong with my system?

[sorry, missed the message]

You need both -DLLVM_USE_SANITIZE_COVERAGE=ON and -DLLVM_USE_SANITIZER=Address.

http://llvm.org/docs/LibFuzzer.html should be up-to-date.

http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-fuzzer is running it 24/7 and is green.

–kcc

Yeah, I figured this out eventually. The problem was that because of
pr23604 I had to turn off -Werror, so I missed the warnings that make
what was going wrong obvious.

Thanks!

Kostya Serebryany <kcc@google.com> writes: