Problems getting the Static Analyser to work

Hi all,

I’ve been hearing people raving about the static analyser in clang and it does look very impressive so I’ve been wanting to try it out for myself. The problem is that it doesn’t seem to want to compile my code. When I run the following command I get errors with my code:

./clang/scan-build -V -o /results xcodebuild -configuration “Debug”

For every file it tries compiling I get the following:

Traceback (most recent call last):
File “/Users/martinpilkington/Personal/M3/Apps/Lighthouse Keeper/Lighthouse Keeper/dev/clang/ccc-analyzer”, line 286, in
main(sys.argv[1:])
File “/Users/martinpilkington/Personal/M3/Apps/Lighthouse Keeper/Lighthouse Keeper/dev/clang/ccc-analyzer”, line 283, in main
analyze(clang, analyze_args, language, output, files, verbose, htmldir, file, analysis_type)
File “/Users/martinpilkington/Personal/M3/Apps/Lighthouse Keeper/Lighthouse Keeper/dev/clang/ccc-analyzer”, line 87, in analyze
subprocess.call(args)
File “/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/subprocess.py”, line 443, in call
return Popen(*popenargs, **kwargs).wait()
File “/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/subprocess.py”, line 593, in init
errread, errwrite)
File “/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/subprocess.py”, line 1079, in _execute_child
raise child_exception
OSError: [Errno 2] No such file or directory

I’ve tried this on two machines (both running OS X 10.5.4 and Xcode 3.1). I’ve tried this with checker-57 and checker-60 (62 seems to have a bug that makes it not want to work at all with paths with spaces in the name). The project builds fine if I build from Xcode or run xcodebuild on its own but I get 27 failures (one for each file). Is there some sort of configuration setting or something I’m missing? Please be warned that I’m not the most command line savvy of people.

Thanks

Hi Martin,

This looks like a problem in the python script ccc-analyzer which acts as a replacement to gcc, spawning off invocations to gcc and clang (the static analyzer) respectively.

The best thing to do is probably to file a bugzilla report for this. That way we can track the progress of the bug fix.

In the bug report, can you provide the output of scan-build when you use 3 “-v” options? It would be good to see the exact invocation (arguments) that are passed to ccc-analyzer that leads to this problem.

Best,
Ted

Hi Martin,

I realized that the issue may be that the path to your project contains spaces. There was a bug fix that went into checker-62 (released July 15) that addressed some issues in scan-build with paths with spaces. Please try out checker-63 (released today) to see if the problem disappears.

Best,
Ted