llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
28.76k stars 11.89k forks source link

Build compiler-rt failed on windows+visual studio #106490

Open YWtheGod opened 2 months ago

YWtheGod commented 2 months ago

VS 2022 17.11.2+WINDOWS 11 23H2

CMAKE Command Line:

"C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\cmake.exe" -S llvm -B VS22build -DLLVM_ENABLE_PROJECTS="clang;lld;clang-tools-extra;lldb" -DLLVM_TARGETS_TO_BUILD="X86;AArch64;ARM;WebAssembly" -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_RUNTIMES="compiler-rt" -DCMAKE_C_FLAGS="/source-charset:utf-8" -DCMAKE_CXX_FLAGS="/source-charset:utf-8" -DCMAKE_ASM_FLAGS="/source-charset:utf-8" -DLLVM_USE_SANITIZER="Address"

when configuring compiler-rt, exception raised:

-- Compiler-RT supported architectures: x86_64 -- check-shadowcallstack does nothing. -- Configuring done (4.5s) CMake Error at CMakeLists.txt:269 (add_dependencies): The dependency target "asan" of target "runtimes-test-depends" does not exist.

CMake Error at CMakeLists.txt:269 (add_dependencies): The dependency target "ubsan" of target "runtimes-test-depends" does not exist.

kamrann commented 2 weeks ago

I hit the same problem following the instructions at https://clang.llvm.org/docs/AddressSanitizer.html#how-to-build. However if instead I use -DLLVM_ENABLE_PROJECTS="clang;compiler-rt" and drop the -DLLVM_ENABLE_RUNTIMES argument, I'm able to build asan without issue. So perhaps this is just a documentation issue?