$ clang -O4 -faddress-sanitizer a.c /usr/bin/x86_64-pc-linux-gnu-ld: error: cannot open /usr/bin/../lib/clang/3.1/lib/linux/libclang_rt.asan-x86_64.a: No such file or directory lto-llvm.o-WK9UAf:ld-temp.o:function asan.module_ctor: error: undefined reference to '__asan_init' clang: error: linker command failed with exit code 1 (use -v to see invocation) The problem is that the library is installed in ../lib64, and clang seems to hardcode just ../lib in a lot of places.
I don't know much about this area. Chandler, Daniel, could you please comment? From what I can see: tools/clang/lib/Driver/Driver.cpp: StringRef ClangResourceDir(CLANG_RESOURCE_DIR); SmallString<128> P(Dir); if (ClangResourceDir != "") llvm::sys::path::append(P, ClangResourceDir); else llvm::sys::path::append(P, "..", "lib", "clang", CLANG_VERSION_STRING); So, perhaps, if the run-time libraries are going to be placed in lib64, CLANG_RESOURCE_DIR needs to be redefined at the build time. The LLVM 3.1 binaries for Ubuntu 12.04 available at http://llvm.org/releases/download.html#3.1 have libclang_rt.asan-x86_64.a installed in lib/clang (no lib64)
(In reply to comment #1) > The LLVM 3.1 binaries for Ubuntu 12.04 available at > http://llvm.org/releases/download.html#3.1 have libclang_rt.asan-x86_64.a > installed in lib/clang (no lib64) We were considering installing them into /usr/lib too just to work-around the issue but prefer having it fixed instead.
I think this one was fixed already. Not that three years later I consider it actually a good idea :).