checker 0.195 fails on Mac (can't find 'stdint.h')

I downloaded the latest Mac version of the checker, but it fails. I CD into my Xcode project directory, then:

Success:
$ xcodebuild clean; ~/development/checker-0.147/scan-build -k -V xcodebuild

Fail:
$ xcodebuild clean; ~/development/checker-0.195/scan-build -k -V xcodebuild

Details:

1. Download and decompress the checker distribution into ~/development/checker-0.147/
2. CD into my xcode project directory.
3. Execute:

$ xcodebuild clean; ~/development/checker-0.147/scan-build -k -V xcodebuild

This command works correctly. But the new version:

$ xcodebuild clean; ~/development/checker-0.195/scan-build -k -V xcodebuild

  /Users/Gary/Development/checker-0.195/lib/clang/1.0/include/stdint.h:32:16: fatal error: 'stdint.h' file not found

  # include_next <stdint.h>
                ^
  1 diagnostic generated.

I haven't set any paths. Has something changed that that an Include path is required to find stdint.h, which is in:

  checker-0.195/lib/clang/1.0/include/stdint.h

What path should I set?

Thanks,
Gary

This is fallout from
  http://llvm.org/viewvc/llvm-project?view=rev&revision=70806
but I'm not sure of the right fix. As a temporary workaround, changing

Y, the '#if 0' worked. Thanks so much!

I'm on OSX 10.5.6.

Yes,
/usr/include/stdint.h -> gcc/darwin/default/stdint.h

Love this tool. Can we update the webpage updated to reflect this patch? I'm guessing a lot of people will try the tool and get stopped by this issue. Also, the tool is considerably simpler to run successfully when preceded by 'xcodebuild clean' for XCode/iPhone development. So that tip on the web page would help newbies, too.

Thanks,
Gary

This is fallout from
http://llvm.org/viewvc/llvm-project?view=rev&revision=70806
but I'm not sure of the right fix. As a temporary workaround, changing
--
+#if __STDC_HOSTED__
--
to
--
+#if 0
--
in clang's stdint.h should work.

Eli, this is fallout from your patch, do you have an idea for a better solution?

-Chris

I think Eli's solution is fine, but we probably need an additional
define for whether the platform has its own stdint.h to fall back to,
so that we can change the #if test to something like

Yes, that seems like the right solution; as far as I can tell, Darwin
doesn't normally provide a system stdint.h. I'm a little surprised it
took nearly a week for anyone to notice, though; is there some
commonly installed package that provides stdint.h anyway?

-Eli

Darwin does have a /usr/include/stdint.h, but I think the iPhone SDK
may not, and builds may use -isysroot. I haven't verified this guess
yet though...

- Daniel

Hi Gary,

We suspect that the version of the iPhone SDK you are using did not (by accident) include stdint.h. What version are you using?

Can you provide the output of 'scan-build -v -v' around the command that is failing? We're looking for the invocation of 'clang-cc' that produces the error that you are seeing.

Ted

We suspect that the version of the iPhone SDK you are using did not (by accident) include stdint.h. What version are you using?

Can you provide the output of 'scan-build -v -v' around the command that is failing? We're looking for the invocation of 'clang-cc' that produces the error that you are seeing.

Ok, using the original stdint.h file, and '-v -v', the many errors look like:

[LOCATION]: /Users/Gary/Development/projects/TestProg
'/Users/Gary/Development/checker-0.195/libexec/clang-cc' '-DIBOutlet=__attribute__((iboutlet))' '-arch' 'armv6' '-x' 'objective-c' '-analyzer-store=basic' '-analyzer-constraints=range' '-analyzer-output=html' '-std=c99' '-fpascal-strings' '-isysroot' '/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS2.2.sdk' '-miphoneos-version-min=2.2' '-iquote' '/Users/Gary/Development/projects/TestProg/build/TestProg.build/Release-iphoneos/TestProg.build/TestProg-generated-files.hmap' '-I/Users/Gary/Development/projects/TestProg/build/TestProg.build/Release-iphoneos/TestProg.build/TestProg-own-target-headers.hmap' '-I/Users/Gary/Development/projects/TestProg/build/TestProg.build/Release-iphoneos/TestProg.build/TestProg-all-target-headers.hmap' '-iquote' '/Users/Gary/Development/projects/TestProg/build/TestProg.build/Release-iphoneos/TestProg.build/TestProg-project-headers.hmap' '-F/Users/Gary/Development/projects/TestProg/build/Release-iphoneos' '-I/Users/Gary/Development/projects/TestProg/build/Release-iphoneos/include' '-I/Users/Gary/Development/projects/TestProg/build/TestProg.build/Release-iphoneos/TestProg.build/DerivedSources' '-include' '/Users/Gary/Development/projects/TestProg/TestProg_Prefix.pch' '/Users/Gary/Development/projects/TestProg/Classes/GraphOverlayView.m' '-analyze' '-analyzer-display-progress' '-disable-free' '-analyzer-eagerly-assume' '-warn-objc-unused-ivars' '-warn-objc-methodsigs' '-checker-cfref' '-warn-dead-stores'
In file included from <built-in>:97:
In file included from <command line>:2:
In file included from /Users/Gary/Development/projects/TestProg/TestProg_Prefix.pch:6:
In file included from /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS2.2.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:6:
In file included from /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS2.2.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CoreFoundation.h:11:
In file included from /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS2.2.sdk/usr/include/sys/types.h:81:
In file included from /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS2.2.sdk/usr/include/machine/endian.h:39:
In file included from /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS2.2.sdk/usr/include/arm/endian.h:74:
In file included from /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS2.2.sdk/usr/include/sys/_endian.h:124:
In file included from /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS2.2.sdk/usr/include/libkern/_OSByteOrder.h:70:
In file included from /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS2.2.sdk/usr/include/libkern/arm/OSByteOrder.h:8:
/Users/Gary/Development/checker-0.195/lib/clang/1.0/include/stdint.h:32:16: fatal error: 'stdint.h' file not found

# include_next <stdint.h>
                ^
1 diagnostic generated.

Thanks,
Gary

In this example it doesn't look like you are using the simulator sdk (the '-arch armv6' looks suspicious). The rest of the output, however, is very useful. I'll try and dig into this more soon.

Thanks Gary!

In this example it doesn't look like you are using the simulator sdk (the '-arch armv6' looks suspicious). The rest of the output, however, is very useful. I'll try and dig into this more soon.

I just checked again; I'm running my iPhone project in the simulator. Then I run

  xcodebuild clean; ~/development/checker-0.195/scan-build -v -v xcodebuild

and see the output below, including the "-arch armv6".

Interesting... I also see "armv6" when I run 0.147, which compiles, shows errors, and didn't have the stdint.h issue.

Thanks,
Gary