I'm trying to use the gcc address sanitizer in Qt by adding CONFIG += sanitizer sanitize_address
to my .pro
file but I'm getting an error: cannot find -lasan
.
How should I install the library?
I'm using the MinGW provided by Qt but I could also try a standalone version.
Related question: MinGW-w64's gcc and Address Sanitizer
Unfortunately GCC does not support Asan on Windows: here's an excerpt from libsanitizer/configure.tgt:
case "${target}" in
x86_64-*-linux* | i?86-*-linux*)
...
powerpc*-*-linux*)
...
sparc*-*-linux*)
...
s390*-*-linux*)
...
sparc*-*-solaris2.11*)
...
arm*-*-linux*)
...
mips*64*-*-linux*)
...
mips*-*-linux*)
...
aarch64*-*-linux*)
...
x86_64-*-darwin[1]* | i?86-*-darwin[1]*)
...
x86_64-*-solaris2.11* | i?86-*-solaris2.11*)
...
*)
UNSUPPORTED=1
;;
esac
Note that Clang supports it (with some effort - see wiki for details) and many people have successfully used it.