qcoro
qcoro copied to clipboard
CI: Re-enable ASAN in clang-cl builds
I was able to get qcoro compiled with ASAN using clang-cl, but the executables seem broken - they don't start - I suspect it could be the mix of Qt libs and clang's asan (??), but I have no clue, really...
Hello,
Do you have any output from the executable start failure? I was able to build with clang-cl as well and I suspect this is due to the executables not being able to find the needed dlls on windows.
Hi,
the error I got was 0xc0000135 and the executable would exit immediately, so I also suspect it's trouble locating the right path to the ASAN dlls.
To make things more complicated, the MSVC and clang-cl ASAN runtimes are different, so getting the right path is also tricky, but the basis for that is in the GH actions code.
Typically that error code is due to missing dlls
. One possible solution is to use windeployqt to copy the dlls to the binary directory. If this is desired I can file a PR. This could be done as part of the build on windows using CMake.
Aah, that's a good idea :-) I think it's OK to have it as part of the regular CMake build, but only for tests and maybe examples, though. For the library itself I think it's not our responsibility to drag along the dependencies.
If you want to work on it, I'll be more than happy to review & merge your PR. I want to have full ASAN coverage in CI.
Sure thing! I think I can manage that and file a PR. And yes I would agree, it's only needed for the executables, not the library itself.
I too am interested in using ASAN. I've tried it with your project and some at work but all I keep getting are access violation errors in the debug output. I tried reproducing #68 but I couldn't due to the issues I was having.
After some further testing, it looks like the error code may be due also in part to the missing clang-cl ASAN runtime dll. If you run an example or test from within Visual Studio, things work correctly because Visual Studio appends to the path the correct directory for the ASAN runtime depending on your compiler.
If you instead just open up a command window or powershell and run ctest -C Debug
in the build directory, you will get 0xc0000135 errors due to the missing dll. Running ctest
via the Visual Studio command prompt allowed me to properly run the tests.
Also, how are you compiling with clang-cl? The build fails for me because MDd is set and that is not yet supported for ASAN with clang-cl
.
Yeah, I suspected it's some paths to the DLLs missing. In the CI script I am trying to set the path and I think the path is correct. I was also struggling with some weird compiler errors, I think /INFERASANLIBS
was getting injected somehow to the command line and clang-cl doesn't support that.
In Visual Studio I simply selected ClangCL, in the CI I explicitly enable clang-cl with the -T
switch:
cmake -T ClangCL ...
In both cases there's a bit of magic inside CMake that recognizes ClangCL and adjusts some of the flags, and it seems to work for me just fine :)