I'm trying to compile a program using the address sanitizer and/or the 
undefined behavior sanitizer. I've tried clang 18 and gcc 15 and neither seem 
to be able to link:

$ clang-mp-18 -fsanitize=address test.c -o test
ld: file not found: 
/opt/local/libexec/llvm-18/lib/clang/18/lib/darwin/libclang_rt.asan_osx_dynamic.dylib
clang: error: linker command failed with exit code 1 (use -v to see invocation)

$ clang-mp-18 -fsanitize=undefined test.c -o test
ld: file not found: 
/opt/local/libexec/llvm-18/lib/clang/18/lib/darwin/libclang_rt.ubsan_osx_dynamic.dylib
clang: error: linker command failed with exit code 1 (use -v to see invocation)

$ gcc-mp-15 -fsanitize=address test.c -o test
ld: library not found for -lasan
collect2: error: ld returned 1 exit status

$ gcc-mp-15 -fsanitize=undefined test.c -o test
ld: library not found for -lubsan
collect2: error: ld returned 1 exit status

Is this supposed to work? Am I supposed to be doing something else to get this 
to work?


Reply via email to