scan-build error

I’m using scan-build to build OC projects, when the command is "scan-build xcodebuild -target … ", it works and bugs found. But “scan-build” ( contents ‘xcodebuild -target …’) throws error with <all-product-headers.yaml: error>.
Is there any difference between those two build command? And how to build successfully with scan-build a


Essentially, scan-build is a fairly lightweight script. Xcode is supported with a simple pattern matching of a command that is run via scan-build.

  if ($Cmd =~ /\bxcodebuild$/) {
    return RunXcodebuild($Args, $IgnoreErrors, $CCAnalyzer, $CXXAnalyzer, $EnvVars);

So, in your particular case, the only way to do it with a script is to call scan-build within this script as well.

Another thing you could try is to turn your Xcode project inside out by running the shell script from inside the Xcode project (as a “Run Script Phase”) instead of running xcodebuild from inside the shell script.

But generally, yeah, scan-build has explicit support for xcodebuild but it can’t work unless scan-build is to invoke xcodebuild directly.