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

James Burgess jamesrburgess at me.com
Sat Dec 20 22:35:15 PST 2014


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





More information about the cfe-dev mailing list