torano
torano

Reputation: 105

Can I use Thread Sanitizer on Windows 10?

I'd like to test data races in C++ on windows 10(64 bit), but it seems that Visual C++ doesn't support it yet. So, I installed Cygwin and got g++ 11.2.0, tried compiling my C++ code with -fsanitize=thread -fPIE -pie -g, but it failed with -ltsan not found error.

The doc doesn't say anything about Windows. Is it even possible to use Thread Sanitizer on Windows? If so, How?

Upvotes: 2

Views: 2235

Answers (2)

torano
torano

Reputation: 105

Just use WSL and use thread sanitizer on it.

Upvotes: -1

Bernd
Bernd

Reputation: 2221

The sanitizers you linked are implemented in Clang, not MSVC or gcc. You can use clang with Visual Studio. To do so you need to install the appropiate toolchain. You can run clang directly on Windows, via cygwin or via WSL.

In addition could you post your complete compile command (e.g. via godbolt.org)?

e.g.: https://godbolt.org/z/fax6o9E1f

Upvotes: 1

Related Questions