Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CLANG giving errors complaining about defective header file UILocalizedIndexedCollation.h

Tags:

iphone

clang

I ran into this error when building my code with CLANG:

In file included from /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.0.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIKit.h:31,
                 from /Users/waspfish/Documents/NanaimoStudio/Projects/iPhoneMonk/Projects/IdeaOrganizer/IdeaOrganizer_Prefix.pch:13,
                 from :1:
/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.0.sdk/System/Library/Frameworks/UIKit.framework/Headers/UILocalizedIndexedCollation.h:13: error: syntax error before ‘AT_NAME’ token
/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.0.sdk/System/Library/Frameworks/UIKit.framework/Headers/UILocalizedIndexedCollation.h:21: error: syntax error before ‘}’ token
/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.0.sdk/System/Library/Frameworks/UIKit.framework/Headers/UILocalizedIndexedCollation.h:23: fatal error: method definition not in @implementation context
compilation terminated.
{standard input}:32:FATAL:.abort  detected.  Assembly stopping.

I ended up having to exclude the UILocalizedIndexedCollation.h from UIKit.h and everything built fine. Any idea what could have caused the problem? I can't imagine Apple is shipping a defective header file.

like image 660
Boon Avatar asked Jan 24 '23 11:01

Boon


2 Answers

The problem comes from SDK 3.0 which now use gcc 4.2 but scan-build still use /usr/bin/gcc. So you need to tell scan-build to use /usr/bin/gcc-4.2 instead.

scan-build --use-cc=/usr/bin/gcc-4.2 xcodebuild -configuration Debug

Et voila!

like image 163
Djiss Avatar answered Jan 26 '23 01:01

Djiss


Apple’s engineer had confirmed that they had a bug in UIKit framework:

We do have a simple workaround for this UIKit bug. In UILocalizedIndexedCollation.h change this:

UIKIT_EXTERN @interface UILocalizedIndexedCollation : NSObject
to
UIKIT_EXTERN_CLASS @interface UILocalizedIndexedCollation : NSObject 

Denis2342

like image 27
denis2342 Avatar answered Jan 25 '23 23:01

denis2342