Problem when using scan-build

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Problem when using scan-build

Robinson, Paul via cfe-dev
With --use-c=gcc and --use-analyzer=clang when run "scan-build" it will use include<...> of clang , but we need include<...> of gcc. How can I define the default include path of gcc when I run "scan-build --use-c=gcc --use-analyzer=clang make" ?
_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Problem when using scan-build

Robinson, Paul via cfe-dev
This question is related little to scan-build. scan-build calls clang, so if you know how to compile your code with clang and use gcc specific header files, then you got the answer... You shall know, there are compiler specific header files, which you won't be able to interchange between compilers. Please be more specific with your question which header files you wish to be used. And also, in order to get help, you need to tell more about your setup. (what os? what version of gcc? which clang version? how clang got compiled? etc..)

On Mon, Feb 20, 2017 at 6:19 PM, 逆水x轻风 via cfe-dev <[hidden email]> wrote:
With --use-c=gcc and --use-analyzer=clang when run "scan-build" it will use include<...> of clang , but we need include<...> of gcc. How can I define the default include path of gcc when I run "scan-build --use-c=gcc --use-analyzer=clang make" ?
_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev



_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Problem when using scan-build

Robinson, Paul via cfe-dev
The scan-build tool should be using the original compiler for compiling
(transparently) and clang for analysis (inevitably). It means that both
compilers need to compile the code independently (even though the clang
instance that is used for analysis doesn't produce any binaries, all
earlier phases of compilation need to occur), which means they need to
find all includes. It also means that if a certain translation unit
cannot be compiled with clang (with relevantly interposed compilation
flags), it cannot be analyzed.

So i'd second the question regarding which includes you're having
problems with.

On 2/20/17 1:04 PM, Laszlo Nagy via cfe-dev wrote:

> This question is related little to scan-build. scan-build calls clang,
> so if you know how to compile your code with clang and use gcc
> specific header files, then you got the answer... You shall know,
> there are compiler specific header files, which you won't be able to
> interchange between compilers. Please be more specific with your
> question which header files you wish to be used. And also, in order to
> get help, you need to tell more about your setup. (what os? what
> version of gcc? which clang version? how clang got compiled? etc..)
>
> On Mon, Feb 20, 2017 at 6:19 PM, 逆水x轻风 via cfe-dev
> <[hidden email] <mailto:[hidden email]>> wrote:
>
>     With --use-c=gcc and --use-analyzer=clang when run "scan-build" it
>     will use include<...> of clang , but we need include<...> of gcc.
>     How can I define the default include path of gcc when I run
>     "scan-build --use-c=gcc --use-analyzer=clang make" ?
>     _______________________________________________
>     cfe-dev mailing list
>     [hidden email] <mailto:[hidden email]>
>     http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
>     <http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev>
>
>
>
>
> _______________________________________________
> cfe-dev mailing list
> [hidden email]
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev

_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

回复: Re: Problem when using scan-build

Robinson, Paul via cfe-dev
Thank you for answering my email. The cmd we use is "scan-build --use-analyzer=/home/clang/bin/clang --use-cc=/home/gcc/arm-none-eabi/bin/arm-none-eabi-gcc --analyzer-target=arm-linux-gnueabi make -s MMU=2 products_isp=hi6250 -j"

The version of clang is 3.8.256229 and gcc is 4.7.1 and os is Ubuntu 12.04
The error log of clang is :
In file include from /usr/include/math.h/usr/include/bits/matchcalls.h:110:1 error expected identifier or "("
________________________________
However, /usr/include/math.h is not the head file we need, we found /usr/include/ is the default include <...> path of clang. Actually, we need /home/gcc/arm-none-eabi/include/math.h , it's in the default include path of gcc(/home/gcc/arm-none-eabi/include/).

So, how can we use the include path of gcc when run the scan-build cmd ?
---原始邮件---
发件人:"Artem Dergachev"<[hidden email]>
发送时间:2017年2月20日 星期一 下午10:57
收件人:"Laszlo Nagy"<[hidden email]>;"逆水x轻风"<[hidden email]>
抄送:"cfe-dev"<[hidden email]>
主题:Re: [cfe-dev] Problem when using scan-build
The scan-build tool should be using the original compiler for compiling
(transparently) and clang for analysis (inevitably). It means that both
compilers need to compile the code independently (even though the clang
instance that is used for analysis doesn't produce any binaries, all
earlier phases of compilation need to occur), which means they need to
find all includes. It also means that if a certain translation unit
cannot be compiled with clang (with relevantly interposed compilation
flags), it cannot be analyzed.
So i'd second the question regarding which includes you're having
problems with.
On 2/20/17 1:04 PM, Laszlo Nagy via cfe-dev wrote:

> This question is related little to scan-build. scan-build calls clang,
> so if you know how to compile your code with clang and use gcc
> specific header files, then you got the answer... You shall know,
> there are compiler specific header files, which you won't be able to
> interchange between compilers. Please be more specific with your
> question which header files you wish to be used. And also, in order to
> get help, you need to tell more about your setup. (what os? what
> version of gcc? which clang version? how clang got compiled? etc..)
>
> On Mon, Feb 20, 2017 at 6:19 PM, 逆水x轻风 via cfe-dev
> <[hidden email] <mailto:[hidden email]>> wrote:
>
>     With --use-c=gcc and --use-analyzer=clang when run "scan-build" it
>     will use include<...> of clang , but we need include<...> of gcc.
>     How can I define the default include path of gcc when I run
>     "scan-build --use-c=gcc --use-analyzer=clang make" ?
>     _______________________________________________
>     cfe-dev mailing list
>     [hidden email] <mailto:[hidden email]>
>     http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
>     <http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev>
>
>
>
>
> _______________________________________________
> cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev

_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Problem when using scan-build

Robinson, Paul via cfe-dev
Hi again,

these information are still not enough to help you out. So, I only can guess what you have or trying to achieve... As I suggested earlier, try to compile your project with Clang as a first step. If you done that, scan-build won't be an issue... As far as I can see, you have a cross-compiler gcc and a native clang compiler. (Is this correct?) You might want to look at these pages: https://clang.llvm.org/docs/CrossCompilation.html http://llvm.org/docs/HowToCrossCompileLLVM.html

Regards,
Laszlo

On Thu, Feb 23, 2017 at 2:51 PM, 逆水x轻风 <[hidden email]> wrote:
Thank you for answering my email. The cmd we use is "scan-build --use-analyzer=/home/clang/bin/clang --use-cc=/home/gcc/arm-none-eabi/bin/arm-none-eabi-gcc --analyzer-target=arm-linux-gnueabi make -s MMU=2 products_isp=hi6250 -j"

The version of clang is 3.8.256229 and gcc is 4.7.1 and os is Ubuntu 12.04
The error log of clang is :
In file include from /usr/include/math.h/usr/include/bits/matchcalls.h:110:1 error expected identifier or "("
________________________________
However, /usr/include/math.h is not the head file we need, we found /usr/include/ is the default include <...> path of clang. Actually, we need /home/gcc/arm-none-eabi/include/math.h , it's in the default include path of gcc(/home/gcc/arm-none-eabi/include/).

So, how can we use the include path of gcc when run the scan-build cmd ?
---原始邮件---
发件人:"Artem Dergachev"<[hidden email]>
发送时间:2017年2月20日 星期一 下午10:57
收件人:"Laszlo Nagy"<[hidden email]>;"逆水x轻风"<[hidden email]>
抄送:"cfe-dev"<[hidden email]>
主题:Re: [cfe-dev] Problem when using scan-build

The scan-build tool should be using the original compiler for compiling
(transparently) and clang for analysis (inevitably). It means that both
compilers need to compile the code independently (even though the clang
instance that is used for analysis doesn't produce any binaries, all
earlier phases of compilation need to occur), which means they need to
find all includes. It also means that if a certain translation unit
cannot be compiled with clang (with relevantly interposed compilation
flags), it cannot be analyzed.
So i'd second the question regarding which includes you're having
problems with.
On 2/20/17 1:04 PM, Laszlo Nagy via cfe-dev wrote:

> This question is related little to scan-build. scan-build calls clang,
> so if you know how to compile your code with clang and use gcc
> specific header files, then you got the answer... You shall know,
> there are compiler specific header files, which you won't be able to
> interchange between compilers. Please be more specific with your
> question which header files you wish to be used. And also, in order to
> get help, you need to tell more about your setup. (what os? what
> version of gcc? which clang version? how clang got compiled? etc..)
>
> On Mon, Feb 20, 2017 at 6:19 PM, 逆水x轻风 via cfe-dev
> <[hidden email] <mailto:[hidden email]>> wrote:
>
>     With --use-c=gcc and --use-analyzer=clang when run "scan-build" it
>     will use include<...> of clang , but we need include<...> of gcc.
>     How can I define the default include path of gcc when I run
>     "scan-build --use-c=gcc --use-analyzer=clang make" ?
>     _______________________________________________
>     cfe-dev mailing list
>     [hidden email] <mailto:[hidden email]>
>     http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
>     <http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev>
>
>
>
>
> _______________________________________________
> cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev


_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Loading...