Clang: ‘Could not find clang-cc line’ error

This is a problem I ran into when trying to use the clang static analyzer with my iPhone app. I kept getting the error ‘could not find clang-cc line’ and Google didn’t provide much information about it.  I had to follow a number of steps to get it to work properly:

  • First, I had to change the Base SDK in the project settings to match my current target build.  I had a mismatch here that caused clang to give me the above error.  I ended up using the debug simulator build.
  • Next, I turned off code signing in the project settings, but I’m not sure if this is strictly necessary
  • Then, I cleaned the build with xcodebuild -configuration Debug clean
  • Finally, I forced it to analyze the debug build by running scan-build xcodebuild -configuration Debug

Once I got it all worked out, it was awesome! It found two serious bugs and a couple other minor ones.  It totally was worth the headache of getting it working!


4 Responses to “Clang: ‘Could not find clang-cc line’ error”

Leave a Reply