README.md
1# Running the fuzzers locally
2
3There is a [helper script](build.sh) to build the fuzzers, which has only been
4tested on Debian and Ubuntu linux so far. There should be no problems fuzzing on
5Windows (using clang>=8) or on Mac, but the script will probably not work out of
6the box.
7
8Something along
9```sh
10mkdir build
11cd build
12export CXX=clang++
13export CXXFLAGS="-fsanitize=fuzzer-no-link -DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION= -g"
14cmake .. -DFMT_SAFE_DURATION_CAST=On -DFMT_FUZZ=On -DFMT_FUZZ_LINKMAIN=Off -DFMT_FUZZ_LDFLAGS="-fsanitize=fuzzer"
15cmake --build .
16```
17should work to build the fuzzers for all platforms which clang supports.
18
19Execute a fuzzer with for instance
20```sh
21cd build
22export UBSAN_OPTIONS=halt_on_error=1
23mkdir out_chrono
24bin/fuzzer_chrono_duration out_chrono
25```
26