I am using Debian Unstable/Experimental.
When I use -fsanitize=address with clang-22, it fails with:
/usr/bin/ld: cannot find /usr/lib/llvm-22/lib/clang/22/lib/x86_64-pc-linux-gnu/libclang_rt.asan_static.a: No such file or directory
/usr/bin/ld: cannot find /usr/lib/llvm-22/lib/clang/22/lib/x86_64-pc-linux-gnu/libclang_rt.asan.a: No such file or directory
clang: error: linker command failed with exit code 1 (use -v to see invocation)
In an attempt with a C file, for example:
#include <stdio.h>
#include <unistd.h>
int main() {
printf("Hello, world!\n");
*((volatile char*)NULL) = 3;
return 0;
}
and then compiling it with clang-22 -O3 -Og hello.c -fsanitize=address,undefined -o hello, it fails with the previous linker error. However, using gcc-15 instead of clang-22 compiles flawlessly.
I tried to check for what package provides /usr/lib/llvm-22/lib/clang/22/lib/x86_64-pc-linux-gnu/libclang_rt.asan.a with apt-file search /usr/lib/llvm-22/lib/clang/22/lib/x86_64-pc-linux-gnu/libclang_rt.asan.a, but I found nothing there.
How can I use -fsanitize=address with clang-22 without linker errors?