clang-cl + google sanitizers

已回答

Hi, i'm triying to compile with clang-cl and AddressSanitizer enabled , but nothing seems to work.

 

clang-cl: warning: unknown argument ignored in clang-cl: '-g' [-Wunknown-argument]
clang version 10.0.0
Target: x86_64-pc-windows-msvc
Thread model: posix
InstalledDir: C:\PROGRA~1\LLVM\bin
clang-cl: error: invalid argument '-MDd' not allowed with '-fsanitize=address'
clang-cl: note: AddressSanitizer doesn't support linking with debug runtime libraries yet
NMAKE : fatal error U1077: 'C:\PROGRA~1\LLVM\bin\clang-cl.exe' : return code '0x1'
Stop.
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29333\bin\HostX64\x64\nmake.exe"' : return code '0x2'
Stop.
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29333\bin\HostX64\x64\nmake.exe"' : return code '0x2'
Stop.
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29333\bin\HostX64\x64\nmake.exe"' : return code '0x2'
Stop.

 

0

Hi Fabio,

Thank you for the post! We've added an instruction to our web help: https://www.jetbrains.com/help/clion/google-sanitizers.html#clang-cl-configure.

0

Hi Anna, 

thanks for your reply.

I hade found a similar fix for the "stand-alone" version of clang.

target_link_directories(Teests PRIVATE "C:/Program Files/LLVM/lib/clang/10.0.0/lib/windows")
target_link_libraries(Teests PRIVATE clang_rt.asan_dynamic-x86_64 clang_rt.asan_dll_thunk-x86_64)
target_link_options(Teests PRIVATE /wholearchive:clang_rt.asan_dynamic_runtime_thunk-x86_64.lib)

I have tested both with an example from docs and got the same result: i have no errors compiling in "release mode", but i can't see any log or visual representation for output

 

0

请先登录再写评论。