[cfe-dev] Link error compiling with -faddress-sanitizer (___asan_init undefined)

Sean McBride sean at rogue-research.com
Tue Mar 13 12:12:21 PDT 2012


On Tue, 13 Mar 2012 12:03:09 -0700, Kostya Serebryany said:

>Could you please run the same command line with "-v" to see what libraries
>get linked in?

Kostya,

Thanks for the fast reply.  Here is the whole thing:

builder9:~ builder$ clang -O1 -g -faddress-sanitizer -fno-omit-frame-pointer ~/Desktop/test.c -v
clang version 3.1 (trunk 152633)
Target: x86_64-apple-darwin10.8.0
Thread model: posix
 "/Users/builder/llvm/llvm-rel-bin-install/bin/clang-3.1" -cc1 -triple x86_64-apple-macosx10.6.0 -emit-obj -disable-free -disable-llvm-verifier -main-file-name test.c -pic-level 1 -mdisable-fp-elim -masm-verbose -munwind-tables -target-cpu core2 -v -g -resource-dir /Users/builder/llvm/llvm-rel-bin-install/bin/../lib/clang/3.1 -fmodule-cache-path /var/folders/So/SoDaKVGNF1GdaUhl-VCLoE+++TI/-Tmp-/clang-module-cache -O1 -fdebug-compilation-dir /Users/builder -ferror-limit 19 -fmessage-length 179 -faddress-sanitizer -stack-protector 1 -mstackrealign -fblocks -fobjc-dispatch-method=mixed -fobjc-default-synthesize-properties -fdiagnostics-show-option -fcolor-diagnostics -o /var/folders/So/SoDaKVGNF1GdaUhl-VCLoE+++TI/-Tmp-/test-cnlcGw.o -x c /Users/builder/Desktop/test.c
clang -cc1 version 3.1 based upon LLVM 3.1svn default target x86_64-apple-darwin10.8.0
#include "..." search starts here:
#include <...> search starts here:
 /usr/local/include
 /Users/builder/llvm/llvm-rel-bin-install/bin/../lib/clang/3.1/include
 /usr/include
 /System/Library/Frameworks (framework directory)
 /Library/Frameworks (framework directory)
End of search list.
 "/usr/llvm-gcc-4.2/libexec/gcc/i686-apple-darwin10/4.2.1/ld" -dynamic -arch x86_64 -macosx_version_min 10.6.0 -o a.out -lcrt1.10.6.o /var/folders/So/SoDaKVGNF1GdaUhl-VCLoE+++TI/-Tmp-/test-cnlcGw.o /usr/lib/libstdc++.6.dylib -framework CoreFoundation -lSystem
Undefined symbols:
  "___asan_report_load4", referenced from:
      _main in test-cnlcGw.o
  "___asan_init", referenced from:
      _asan.module_ctor in test-cnlcGw.o
ld: symbol(s) not found
clang-3: error: linker command failed with exit code 1 (use -v to see invocation)







More information about the cfe-dev mailing list