I’m trying to run the ASan tests with make check-asan
as described in the docs here: AddressSanitizer — Clang 16.0.0git documentation
I’ve built LLVM from a git checkout llvmorg-10.0.0
with cmake -G "Unix Makefiles" -DLLVM_TARGETS_TO_BUILD=X86 -DCMAKE_BUILD_TYPE=Release
The check-asan
and check-sanitizers
make targets do not exist when built with this configuration – this seems like a bug?
These targets are present when you’re building the sanitizer runtime itself (see compiler-rt/test/asan/CMakeLists.txt
). Your cmake invocation will only build LLVM, try to pass -DLLVM_ENABLE_PROJECTS=compiler-rt
to cmake to enable building the runtime.
Hi Mehdi, thanks for the response! I was assuming that the default build when you don’t specify specific components would include the compiler runtime (I guess I thought that since it seems to include clang). That’s working now though, thank you.
[Edit]
Just for posterity in case anyone ends up here with the same question, if you enable specific subprojects with -DLLVM_ENABLE_PROJECTS
it will override the defaults for that CMake parameter, so to avoid errors about clang components being missing it’s necessary to say -DLLVM_ENABLE_PROJECTS=compiler-rt;clang
Clang isn’t enabled by default either I believe: only LLVM alone is the default.