[cfe-dev] using scan-build on osx 10.9 command line

Ted Kremenek kremenek at apple.com
Mon Dec 29 22:37:44 PST 2014


Hi James,

I just tried replicating your problem and was unable to do so.

A couple questions:

(1) If you just run "gcc -g main.c" can the compiler successfully compiler main.c?  I'm assuming the answer is "yes", but it is a good sanity check.

(2) Does it work if you pass an explicit SDK path?

For example:

scan-build gcc -g main.c -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk

Cheers,
Ted


> On Dec 20, 2014, at 10:35 PM, James Burgess <jamesrburgess at me.com> wrote:
> 
> Hi, 
> I’m having trouble getting going with scan-build. I downloaded checker-276 from the link on http://clang-analyzer.llvm.org and I can’t get the simplest example to run. The first error is the clang in checker-276 is that it can’t find a system header (stdio.h in my case). I have Xcode 6.0.1 installed and gcc and g++ work fine from the command line:
> 
> jrb$ gcc --version
> Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/c++/4.2.1
> Apple LLVM version 6.0 (clang-600.0.51) (based on LLVM 3.5svn)
> Target: x86_64-apple-darwin13.4.0
> Thread model: posix
> 
> If I use a very simple example:
> jrb$ cat main.c
> #include <stdio.h>
> int
> main(int argc, char** argv)
> {
>   printf("hello world\n");
>   return 0;
> }
> 
> When I run scan-build I get this:
> 
> jrb$ ~/Downloads/checker-276/scan-build gcc -g main.c
> scan-build: Using '/Users/jrb/Downloads/checker-276/bin/clang' for static analysis
> main.c:1:10: fatal error: 'stdio.h' file not found
> #include <stdio.h>
>        ^
> 1 error generated.
> main.c:1:10: fatal error: 'stdio.h' file not found
> #include <stdio.h>
>        ^
> 1 error generated.
> scan-build: 0 bugs found.
> scan-build: The analyzer encountered problems on some source files.
> scan-build: Preprocessed versions of these sources were deposited in '/var/folders/cd/pbxz31kj4bl_x_t1dzxnqxhm0000gn/T/scan-build-2014-12-20-221956-7628-1/failures'.
> scan-build: Please consider submitting a bug report using these files:
> scan-build:   http://clang-analyzer.llvm.org/filing_bugs.html
> 
> 
> - James
> 
> 
> _______________________________________________
> 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