- Use Chromium's prebuilt Clang with sanitizer support.
- Sourced from WebKit's build instruction.
- Any others all doesn't work.
You can compile program with address sanitizer support using command like this:
clang cc -lc++ -std=c++11 -fsanitize=address main.cpp
You are liely to see this error:
dyld: Library not loaded: @executable_path/libclang_rt.asan_osx_dynamic.dylib
Referenced from: /Users/Eonil/Workshop/Sandbox3/cpp-sanitizer-test/cpp-sanitizer-test/./a.out
Reason: image not found
Trace/BPT trap: 5
This happens due to lack of runtime support library for address sanitizer. Copy these files from the Chromium's binaries into the executables folder.
libclang_rt.asan*_dynamic.dylib