I have a project for which I would like to enable the address sanitizer during testing. It is being built and tested on AWS Linux 2 and the compiler is gcc 7.3.1. I need to have libasan dynamically linked because I am testing a Python extension module and the Python executable itself is not built with asan.
After building/ linking my code with -fsanitize=address
, I am starting python (which will load my code) with LD_PRELOAD
as /usr/lib/gcc/x86_64-redhat-linux/7/libasan.so
. That is the path I get from gcc -print-file-name=libasan.so
(and I have confirmed it exists).
When I run, I get
ERROR: ld.so: object '/usr/lib/gcc/x86_64-redhat-linux/7/libasan.so' from LD_PRELOAD cannot be preloaded (file too short): ignored.
Why is this? How do I get libasan to be used? Do I need to install an additional package?