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

Nico Weber thakis at chromium.org
Tue Mar 13 13:19:38 PDT 2012


Did you check out and build compiler-rt as described on
http://clang.llvm.org/get_started.html ? (It's a recent addition, so
if you skipped that page because you already had a clang checkout, you
might have missed it.)

Nico

On Tue, Mar 13, 2012 at 11:54 AM, Sean McBride <sean at rogue-research.com> wrote:
> Hi all,
>
> I'm trying to exactly follow the instructions here:
> <http://clang.llvm.org/docs/AddressSanitizer.html>
>
> Using the same test file and the same invocation:
>
> clang -O1 -g -faddress-sanitizer -fno-omit-frame-pointer example_UseAfterFree.cc
>
> But I get:
>
> Undefined symbols:
>  "___asan_report_load4", referenced from:
>      _main in test-w3FGxl.o
>  "___asan_init", referenced from:
>      _asan.module_ctor in test-w3FGxl.o
>
> This is on OS X 10.6.8 with clang r152633.  I also tried with -arch i386 and -arch x86_64, no difference.  Is there some lib I'm supposed to link with... the docs don't seem to say so.
>
> Thanks,
>
> --
> ____________________________________________________________
> Sean McBride, B. Eng                 sean at rogue-research.com
> Rogue Research                        www.rogue-research.com
> Mac Software Developer              Montréal, Québec, Canada
>
>
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev




More information about the cfe-dev mailing list