[cfe-dev] ld linker error using clang analyzer checker

Yingtong Liu via cfe-dev cfe-dev at lists.llvm.org
Wed Feb 7 15:18:02 PST 2018


Thanks George. Worked.
On Tue, Feb 6, 2018 at 3:54 PM, George Karpenkov <ekarpenkov at apple.com>
wrote:

> Hi Ying,
>
> On Feb 5, 2018, at 5:24 PM, Yingtong Liu via cfe-dev <
> cfe-dev at lists.llvm.org> wrote:
>
> Hi,
>
> I am trying to use clang static checker from command line. I knew there
> are two ways to do that. One is using scan-build command, which works fine
> for me. But I need to use the checker in another way, which is from the
> official website, like:
>
>                clang -Xclang -analyze -Xclang -analyzer-checker=checker_name
> test.c
>
> This reported me /usr/bin/ld: cannot find /tmp/xxx.o: File format not
> recognized. It seems like the xxx.o file never being generated using this
> command line.
>
>
> If the issue is simply invoking the linker, then you can do:
>
> > clang -Xclang -analyze -Xclang -analyzer-checker=checker_name
> -fsyntax-only test.c
>
> OR
>
> > clang —analyze -Xclang -analyze -Xclang -analyzer-checker=checker_name
> test.c
>
> (note the double dash before “analyze”)
>
> I think both should work.
>
>
> When I added -cc1 option, using it like this way,
>
>                 clang -cc1 -analyze -analyzer-checker=xxx test.c
>
> The error is gone, but I have to include all the default compiler headers
> manually, which I don't wanna do.
>
> My question is, what's the right way to pass the checker to clang to get
> the bug report and the built file at the same time?
>
> Thanks,
> Ying
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20180207/67c0962c/attachment.html>


More information about the cfe-dev mailing list