dev-cafe/cmake-cookbook

Chapter-04/Recipe-05 in the book says it was tested on Windows, but valgrind does not work in a Windows environment

Opened this issue · 4 comments

I attempted to compile and test this example on a Windows PC, but ran into issues because I can't find a feasible way to get valgrind in a Windows environment. After searching the internet it looks like it is simply not supported for Windows.

Expected Behavior

I would expect there to be a working example for Windows as well (Maybe using a different tool other than valgrind).

Current Behavior

There is no working example for Windows.

Possible Solution

Having a working example with a different tool other than valgrind for Windows would be helpful

Your Environment

Windows 7
Visual Studio 2017

bast commented

Thanks for reporting. It is true that we have tested this also on Windows but one unfortunate thing is that the configuration will not complain if Valgrind is not found and I did not see that earlier.

I will think about alternatives - my initial thought was to go for the AddressSanitizer but also there you are out of luck on Windows: https://github.com/google/sanitizers/wiki/AddressSanitizer

I think it should work with recent clang WIndows version (clang 8 or 9 a.k.a. trunk)
https://clang.llvm.org/docs/AddressSanitizer.html

Some snapshot build of Clang for Windows are available there:
https://llvm.org/builds/

On linux + cmake I do use those helpers:
https://github.com/arsenm/sanitizers-cmake

which makes it easier to use with CMake.
I have no windows box at hand (and I don't want to :-) so I cannot help much but I can review the code and test it on Linux.

Thanks for the advice! I am really enjoying this book by the way. It is so hard to find good information on CMake anywhere!

There's so many outdated examples on the internet that I always feel like I have to sift through a steaming pile of garbage to learn anything useful...

bast commented

Thank you for the kind feedback - really nice to hear that the material is useful.