views:

802

answers:

5

Hi, 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?

+2  A: 

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

Ashutosh Singh
A: 

I do that and still get this error:

CodeSign error: Code Signing Identity 'iPhone Developer' does not match any code-signing certificate in your keychain.  Once added to the keychain, touch a file or clean the project to continue.

Maybe I must wait until get the iPhone certificate?

mamcx
sure update me when you get the certificate done
Ashutosh Singh
A: 

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.

Alex Vollmer
+1  A: 

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.

Phil Nash
+7  A: 

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.

Frank Szczerba