Search code examples
firefoxgccaddress-sanitizerfuzzing

gcc: error: unrecognized command line option ‘-fsanitize-coverage=trace-pc-guard’


During build of Firefox (older versions including 56.0, 57.0), I encountered the following error a lot of times:

gcc: error: unrecognized command line option ‘-fsanitize-coverage=trace-pc-guard’; did you mean ‘-fsanitize-coverage=trace-pc’?

no matter in an ASAN build or normal debug build.

With normal debug, I used following options:

ac_add_options --disable-jemalloc
ac_add_options --enable-crashreporter
ac_add_options --disable-elf-hack
export MOZ_DEBUG_SYMBOLS=1
ac_add_options --enable-debug-symbols
ac_add_options --disable-install-strip
ac_add_options --disable-strip
ac_add_options --disable-optimize
ac_add_options --enable-debug
ac_add_options --disable-profiling
ac_add_options --enable-fuzzing

My guess is that it has something to do with the option --enable-fuzzing, but no idea why and how to fix.

PS: I have g++, gcc version 7.4.0.


Solution

  • GCC does not support sanitizer coverage but you can use clang instead:

    apt-get install clang
    # or, to force a specific version of clang:
    apt-get install clang-8
    export CC=clang
    export CXX=clang++
    # or, force a specific version of clang:
    export CC=clang-8
    export CXX=clang++-8