[PATCH] D155431: [CMake] Clean up old code for handling MSVC runtime setting the old way

Martin Storsjö via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 27 13:53:46 PDT 2023


mstorsjo added a comment.

In D155431#4651005 <https://reviews.llvm.org/D155431#4651005>, @yurybura wrote:

> This change breaks build on Windows for the Debug configuration with MSVC.
>
> Due to `/D_DEBUG` and `/MDd` are still present on the command line, I see a build error and warning::
>
>   FAILED: projects/compiler-rt/lib/asan/CMakeFiles/RTAsan_dynamic.x86_64.dir/asan_win.cpp.obj 
>   C:\PROGRA~1\MICROS~1\2022\ENTERP~1\VC\Tools\MSVC\1437~1.328\bin\Hostx64\x64\cl.exe   /TP -DASAN_DYNAMIC=1 -DINTERCEPTION_DYNAMIC_CRT -DUNICODE -D_CRT_NONSTDC_NO_DEPRECATE -D_CRT_NONSTDC_NO_WARNINGS -D_CRT_SECURE_NO_DEPRECATE -D_CRT_SECURE_NO_WARNINGS -D_SCL_SECURE_NO_DEPRECATE -D_SCL_SECURE_NO_WARNINGS -D_UNICODE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -ID:\buildtrees\llvm\x64-windows-dbg\projects\compiler-rt\lib\asan -ID:\buildtrees\llvm\src\org-17.0.1-4a67238d53.clean\compiler-rt\lib\asan -ID:\buildtrees\llvm\x64-windows-dbg\include -ID:\buildtrees\llvm\src\org-17.0.1-4a67238d53.clean\llvm\include -ID:\buildtrees\llvm\src\org-17.0.1-4a67238d53.clean\compiler-rt\lib\asan\.. /nologo /DWIN32 /D_WINDOWS /utf-8   /MP  /Zc:inline /Zc:preprocessor /Zc:__cplusplus /Oi /bigobj /permissive- -wd4141 -wd4146 -wd4244 -wd4267 -wd4291 -wd4351 -wd4456 -wd4457 -wd4458 -wd4459 -wd4503 -wd4624 -wd4722 -wd4100 -wd4127 -wd4512 -wd4505 -wd4610 -wd4510 -wd4702 -wd4245 -wd4706 -wd4310 -wd4701 -wd4703 -wd4389 -wd4611 -wd4805 -wd4204 -wd4577 -wd4091 -wd4592 -wd4319 -wd4709 -wd5105 -wd4324 -w14062 -we4238 /W4 /D_DEBUG /MDd /Z7 /Ob0 /Od /RTC1  -std:c++17 -MT /Oy- /GS- /Zc:threadSafeInit- /Z7 /wd4146 /wd4291 /wd4391 /wd4722 /wd4800 /GR- "/experimental:external /external:W0 /external:anglebrackets" /showIncludes /Foprojects\compiler-rt\lib\asan\CMakeFiles\RTAsan_dynamic.x86_64.dir\asan_win.cpp.obj /Fdprojects\compiler-rt\lib\asan\CMakeFiles\RTAsan_dynamic.x86_64.dir\ /FS -c D:\buildtrees\llvm\src\org-17.0.1-4a67238d53.clean\compiler-rt\lib\asan\asan_win.cpp
>   cl : Command line warning D9025 : overriding '/MDd' with '/MT'
>   cl : Command line warning D9002 : ignoring unknown option '/experimental:external /external:W0 /external:anglebrackets'
>   D:\buildtrees\llvm\src\org-17.0.1-4a67238d53.clean\compiler-rt\lib\asan\asan_win.cpp(257): fatal error C1189: #error:  Please build the runtime with a non-debug CRT: /MD or /MT

I'm not able to reproduce this, when testing on latest git main and 17.0.1. Are you manually passing the `/D_DEBUG /MDd` options as cmake options somewhere? Have you done a properly clean reconfigure with cmake? Since the latest cmake policy setup, one is not supposed to pass those options manually anywhere, but just rely on setting `CMAKE_MSVC_RUNTIME_LIBRARY`, which does get hardcoded to `MultiThreaded` for the sanitizers.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D155431/new/

https://reviews.llvm.org/D155431



More information about the llvm-commits mailing list