Description
I installed Clang along with LLVM. I'm trying to understand ASAN. When I try running clang along with ASAN flag like:
clang -fsanitize=address <file_name>
I get the following error
ld: file not found: /Users/vishal/Desktop/llvm/llvmproject/build/lib/clang/11.0.0/lib/darwin/libclang_rt.asan_osx_dynamic.dylib
clang-11: error: linker command failed with exit code 1 (use -v to see invocation)
Clang Version:
clang version 11.0.0 (https://github.com/llvm/llvm-project.git b780df052dd2b246a760d00e00f7de9ebdab9d09) Target: x86_64-apple-darwin18.0.0 Thread model: posix InstalledDir: /Users/vishal/Desktop/llvm/llvm-project/build/bin/.
I see it's an issue with the linker. ASAN instrumented LLVM IR is being produced without any error. The issue seems to be linking the ASAN run-time library using Clang.
I looked through the directory:
/Users/vishal/Desktop/llvm/llvmproject/build/lib/clang/11.0.0/
I couldn't find any folder named "lib" through which the linker is searching. Only one folder named "include" exists.
Is this a known issue or an installation problem?
How can I get over this and compile programs with address sanitizer?