Skip to content

Instantly share code, notes, and snippets.

@GoBigorGoHome
Last active July 5, 2024 12:01
Show Gist options
  • Save GoBigorGoHome/26eebe8db2ff28c3330018dcd1ae1fa1 to your computer and use it in GitHub Desktop.
Save GoBigorGoHome/26eebe8db2ff28c3330018dcd1ae1fa1 to your computer and use it in GitHub Desktop.
Use Asan on Windows with the MSYS2 clang64 toolchain
  1. Install the MSYS2 distribution.

  2. Activate the clang64 environment. For newer versions of MSYS2, it is activated by default. If you have installed an older version, edit MSYS2_ROOT/etc/pacman.conf to activate it.

  3. In the MSYS2 terminal, run pacman -S mingw-w64-clang-x86_64-clang.

  4. Complie AND link your program with -fsanitize=address flag. See https://clang.llvm.org/docs/AddressSanitizer.html#id3 for more information. Note that you have to use the -fsanitize=address flag both when compiling and linking; for example, in CMakeLists.txt, you have to use both target_compile_options(<YOUR_TARGET> PRIVATE -fsanitize=address) and target_link_options(<YOUR_TARGET> PRIVATE -fsanitize=address).

@AbilvapEmiramzaiev
Copy link

Guide is either wrong or not full

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment