Tutorial :Error “Couldn't discover the 'ccc-analyzer'” when running scan-build



Question:

I'm triying to find leaks in my project chibi-ORM using the tool of scan-build as suggested in other threads.

But when run from the terminal:

/Users/mamcx/Downloads/checker-0.138/scan-build  -k -V xcodebuild  

I get this:

009-01-13 10:33:18.296 xcodebuild[14025:4213] Warning:  Couldn't discover the 'ccc-analyzer' compiler's built-in search paths and preprocessor definitions for language dialect 'objective-c'.  This may lead to indexing issues.  Compiler: /Users/mamcx/Downloads/checker-0.138/ccc-analyzer  Reason:   gcc-4.0: installation problem, cannot exec '/Developer/usr/bin/arm-apple-darwin9-gcc-4.0.1': No such file or directory  

However, I can build & debug just fine from the XCode Ide. This is a problem with this tool or something wrong on my side?


Solution:1

the build is failing due to code signing reasons the fix for iphone apps would be to just go to the project’s properties and set the “Base SDK” to “Simulator - iPhone OS 2.1″ rather than “Device”

check in your case what it would be


Solution:2

There's no need to change the project, just add the -sdk flag to the xcodebuild command, for example:

scan-build -k -V xcodebuild -configuration Debug -sdk iphonesimulator2.0  

You can change the 2.0 to be 2.1, 2.2, 2.2.1, or 3.0 to match your target SDK.


Solution:3

What I did to get this to work was to create a new build configuration (which was a dupe of my debug config), which I called Clang, then did the following in the project settings:

  1. set "base SDK" to "Simulator - iPhone OS x.xx"
  2. set Code signing Identity to - "Don't Code Sign"

then, when I run scan-build I do:

scan-build xcodebuild -configuration Clang

(obviously if you named your new build config something different use that name there).

Then it all worked fine and found no bugs in my code (except one false positive) :-)

Also, make sure you do a clean before each scan-build with:

xcodebuild -configuration Clang clean

Otherwise scan-build won't scan the files that have already been built.


Solution:4

Make sure that you can first run xcodebuild on the command-line for your project. In my case I discovered that my project was doing the release build by default and was trying to build for the device. Xcode must add some magic to make it work with certificates because I got the same error messages.

Once I explicitly told it to build with the Debug configuration all worked well. So you may have to run CLang/LLVM with scan-build xcodebuild -configuration Debug.


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »