How to use gcc with sanitizers in Void Linux?
Nan Xiao
xiaonan830818@gmail.com
Thu Dec 26 08:49:00 GMT 2019
Hi gcc community,
Greetings from me!
I am using Void Linux, and want to use sanitizers. Using clang to
compile code, it is OK:
$ clang -std=c11 -fsanitize=address test.c
$
While gcc reports following errors:
$ gcc -std=c11 -fsanitize=address test.c
/usr/bin/ld: cannot find libasan_preinit.o: No such file or directory
/usr/bin/ld: cannot find -lasan
collect2: error: ld returned 1 exit status
I check the program compiled with clang:
$ ldd a.out
linux-vdso.so.1 (0x00007fffd858a000)
libpthread.so.0 => /usr/lib/libpthread.so.0 (0x00007fc1659b8000)
librt.so.1 => /usr/lib/librt.so.1 (0x00007fc1659ad000)
libm.so.6 => /usr/lib/libm.so.6 (0x00007fc165868000)
libdl.so.2 => /usr/lib/libdl.so.2 (0x00007fc165863000)
libgcc_s.so.1 => /usr/lib/libgcc_s.so.1 (0x00007fc165849000)
libc.so.6 => /usr/lib/libc.so.6 (0x00007fc165686000)
/lib64/ld-linux-x86-64.so.2 => /lib/ld-linux-x86-64.so.2 (0x00007fc1659e0000)
No asan library is required.
Could anyone give some clues? Thanks very much in advance!
Best Regards
Nan Xiao
More information about the Gcc-help
mailing list