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”

  1. thrusty 08. Aug, 2009 at 3:16 am #

    Thanks for posting these tips — they definitely helped me. Turning off code signing is definitely not necessary. Also, it helped for me to specify the exact configuration and sdk I wanted, e.g.:

    xcodebuild -sdk iphonesimulator3.0 -configuration Debug

  2. Cram Fighter Team 08. Aug, 2009 at 2:27 pm #

    Awesome, thanks for clarifying.

Trackbacks/Pingbacks

  1. links for 2009-07-02 | manicwave.com - 02. Jul, 2009

    [...] Clang: ‘Could not find clang-cc line’ error « The Cram Fighter Blog 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! (tags: clang-llvm static-analysis quality bugs) [...]

  2. Clang for iPhone - syntax error before ‘AT_NAME’ token - 07. Jul, 2009

    [...] solution for this was at cramfighter.com. Basically I need to change some projects [...]