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

Yingtong Liu via cfe-dev cfe-dev at lists.llvm.org
Tue Feb 6 09:55:19 PST 2018


Thank you Aleksei, it worked to run the checkers.

It seems like clang can't run the checker and do the compiling at the same
time, meaning in one cmd? Just passing the -analyze option and allowing
clang to compile the file will report ld error like I said before. Is that
ture?

Best,
Yingtong

--
Ph.D
Computer Science Department
University of California, Irvine

On Tue, Feb 6, 2018 at 1:34 AM, Aleksei Sidorin <a.sidorin at samsung.com>
wrote:

> Hello,
>
> It looks like clang is thinking that he has to compile the file because
> the default behaviour was not changed via cmdline options. Could you try:
>
> clang --analyze -Xclang -analyzer-checker=checker_name test.c
>
> ? --analyze will tell clang that he doesn't need to produce binary, only
> to analyze the file.
>
>
> 06.02.2018 04:24, Yingtong Liu via cfe-dev пишет:
>
> 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.
>
> 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 listcfe-dev at lists.llvm.orghttp://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
>
>
> --
> Best regards,
> Aleksei Sidorin,
> SRR, Samsung Electronics
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20180206/1f564db9/attachment.html>


More information about the cfe-dev mailing list