Objective Sharpie 因 SDK 头文件中的错误而失败
Objective Sharpie fails with errors originating in the SDK's header files
我正在尝试绑定一个 Objective-C 库,并且我已经成功生成了二进制文件。但是,在使用 Objective Sharpie 时,我得到了一个似乎源自 iOS SDK 内部的错误列表。我启动以下命令:
sharpie bind --output RealtimeSharp --namespace Realtime --sdk iphoneos9.0 ./Realtime/OrtcClient.h
我得到以下输出:
Parsing Native Code...
In file included from /Users/Umar/Documents/Projects/Realtime/Realtime/OrtcClient.h:14:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:10:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSArray.h:5:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSObject.h:19:21: error:
expected a type
- (id)copyWithZone:(nullable NSZone *)zone;
^
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSObject.h:25:28: error:
expected a type
- (id)mutableCopyWithZone:(nullable NSZone *)zone;
^
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSObject.h:32:4: error:
expected a type
- (nullable instancetype)initWithCoder:(NSCoder *)aDecoder; // NS_DESIGNATED_INITIALIZER
^
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSObject.h:53:4: error:
expected a type
- (nullable id)replacementObjectForCoder:(NSCoder *)aCoder;
^
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSObject.h:54:4: error:
expected a type
- (nullable id)awakeAfterUsingCoder:(NSCoder *)aDecoder NS_REPLACES_RECEIVER;
^
In file included from /Users/Umar/Documents/Projects/Realtime/Realtime/OrtcClient.h:14:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:10:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSArray.h:6:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSEnumerator.h:7:15: error:
expected ';' after @class
@class NSArray<ObjectType>;
^
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSEnumerator.h:7:16: error:
cannot find protocol declaration for 'ObjectType'
@class NSArray<ObjectType>;
^
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSEnumerator.h:34:25: error:
cannot find protocol declaration for 'ObjectType'
@interface NSEnumerator<ObjectType> : NSObject <NSFastEnumeration>
^
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSEnumerator.h:34:37: error:
expected identifier or '('
@interface NSEnumerator<ObjectType> : NSObject <NSFastEnumeration>
^
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSEnumerator.h:36:4: error:
expected a type
- (nullable ObjectType)nextObject;
^
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSEnumerator.h:40:25: error:
cannot find protocol declaration for 'ObjectType'
@interface NSEnumerator<ObjectType> (NSExtendedEnumerator)
^
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSEnumerator.h:40:1: error:
duplicate interface definition for class 'NSEnumerator'
@interface NSEnumerator<ObjectType> (NSExtendedEnumerator)
^
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSEnumerator.h:34:12: note:
previous definition is here
@interface NSEnumerator<ObjectType> : NSObject <NSFastEnumeration>
^
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSEnumerator.h:40:37: error:
method type specifier must start with '-' or '+'
@interface NSEnumerator<ObjectType> (NSExtendedEnumerator)
^
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSEnumerator.h:40:38: error:
expected a type
@interface NSEnumerator<ObjectType> (NSExtendedEnumerator)
^
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSEnumerator.h:42:1: error:
expected selector for Objective-C method
@property (readonly, copy) NSArray<ObjectType> *allObjects;
^
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSEnumerator.h:42:28: error:
unknown type name 'NSArray'
@property (readonly, copy) NSArray<ObjectType> *allObjects;
^
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSEnumerator.h:42:35: error:
expected member name or ';' after declaration specifiers
@property (readonly, copy) NSArray<ObjectType> *allObjects;
~~~~~~~^
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSEnumerator.h:42:1: error:
property requires fields to be named
@property (readonly, copy) NSArray<ObjectType> *allObjects;
^ ~~~~~~~
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSEnumerator.h:42:35: error:
expected ';' at end of declaration list
@property (readonly, copy) NSArray<ObjectType> *allObjects;
^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
Error while processing /Users/Umar/Documents/Projects/Realtime/Realtime/OrtcClient.h.
Submitting usage data to Xamarin...
Submitted - thank you for helping to improve Objective Sharpie!
Done. Exiting with error code 1.
error: Clang failed to parse input and exited with code 1
我的 SDK 列表(sharpie xcode -sdks
):
sdk: iphoneos9.0 arch: arm64 armv7
sdk: macosx10.11 arch: x86_64 i386
sdk: watchos2.0 arch:
sdk: watchsimulator2.0 arch:
我的 Objective Sharpie 版本是 (sharpie --version
):
2.1.6p 6e2f8ea 6e2f8ea5ac2f544c58938555a06ef21a4ecb032a 2015-03-17 17:39:55
我的 Xamarin Studio 版本是 5.9.7 (build 9)。
Xamarin says这是 Objective Sharpie 的一个错误,所以他们很快就会发布一个新版本。
我在-c argument
后面加上-xobjective-c
就可以生成绑定成功了。
像这样的东西:
sharpie bind -output Binding -sdk iphoneos9.2 -scope build/Headers build/Headers/Example/Example.h -c -xobjective-c -Ibuild/Headers -arch arm64
我的 Sharpie 版本是 3.0.8。
我正在尝试绑定一个 Objective-C 库,并且我已经成功生成了二进制文件。但是,在使用 Objective Sharpie 时,我得到了一个似乎源自 iOS SDK 内部的错误列表。我启动以下命令:
sharpie bind --output RealtimeSharp --namespace Realtime --sdk iphoneos9.0 ./Realtime/OrtcClient.h
我得到以下输出:
Parsing Native Code...
In file included from /Users/Umar/Documents/Projects/Realtime/Realtime/OrtcClient.h:14:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:10:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSArray.h:5:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSObject.h:19:21: error:
expected a type
- (id)copyWithZone:(nullable NSZone *)zone;
^
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSObject.h:25:28: error:
expected a type
- (id)mutableCopyWithZone:(nullable NSZone *)zone;
^
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSObject.h:32:4: error:
expected a type
- (nullable instancetype)initWithCoder:(NSCoder *)aDecoder; // NS_DESIGNATED_INITIALIZER
^
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSObject.h:53:4: error:
expected a type
- (nullable id)replacementObjectForCoder:(NSCoder *)aCoder;
^
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSObject.h:54:4: error:
expected a type
- (nullable id)awakeAfterUsingCoder:(NSCoder *)aDecoder NS_REPLACES_RECEIVER;
^
In file included from /Users/Umar/Documents/Projects/Realtime/Realtime/OrtcClient.h:14:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:10:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSArray.h:6:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSEnumerator.h:7:15: error:
expected ';' after @class
@class NSArray<ObjectType>;
^
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSEnumerator.h:7:16: error:
cannot find protocol declaration for 'ObjectType'
@class NSArray<ObjectType>;
^
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSEnumerator.h:34:25: error:
cannot find protocol declaration for 'ObjectType'
@interface NSEnumerator<ObjectType> : NSObject <NSFastEnumeration>
^
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSEnumerator.h:34:37: error:
expected identifier or '('
@interface NSEnumerator<ObjectType> : NSObject <NSFastEnumeration>
^
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSEnumerator.h:36:4: error:
expected a type
- (nullable ObjectType)nextObject;
^
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSEnumerator.h:40:25: error:
cannot find protocol declaration for 'ObjectType'
@interface NSEnumerator<ObjectType> (NSExtendedEnumerator)
^
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSEnumerator.h:40:1: error:
duplicate interface definition for class 'NSEnumerator'
@interface NSEnumerator<ObjectType> (NSExtendedEnumerator)
^
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSEnumerator.h:34:12: note:
previous definition is here
@interface NSEnumerator<ObjectType> : NSObject <NSFastEnumeration>
^
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSEnumerator.h:40:37: error:
method type specifier must start with '-' or '+'
@interface NSEnumerator<ObjectType> (NSExtendedEnumerator)
^
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSEnumerator.h:40:38: error:
expected a type
@interface NSEnumerator<ObjectType> (NSExtendedEnumerator)
^
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSEnumerator.h:42:1: error:
expected selector for Objective-C method
@property (readonly, copy) NSArray<ObjectType> *allObjects;
^
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSEnumerator.h:42:28: error:
unknown type name 'NSArray'
@property (readonly, copy) NSArray<ObjectType> *allObjects;
^
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSEnumerator.h:42:35: error:
expected member name or ';' after declaration specifiers
@property (readonly, copy) NSArray<ObjectType> *allObjects;
~~~~~~~^
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSEnumerator.h:42:1: error:
property requires fields to be named
@property (readonly, copy) NSArray<ObjectType> *allObjects;
^ ~~~~~~~
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSEnumerator.h:42:35: error:
expected ';' at end of declaration list
@property (readonly, copy) NSArray<ObjectType> *allObjects;
^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
Error while processing /Users/Umar/Documents/Projects/Realtime/Realtime/OrtcClient.h.
Submitting usage data to Xamarin...
Submitted - thank you for helping to improve Objective Sharpie!
Done. Exiting with error code 1.
error: Clang failed to parse input and exited with code 1
我的 SDK 列表(sharpie xcode -sdks
):
sdk: iphoneos9.0 arch: arm64 armv7
sdk: macosx10.11 arch: x86_64 i386
sdk: watchos2.0 arch:
sdk: watchsimulator2.0 arch:
我的 Objective Sharpie 版本是 (sharpie --version
):
2.1.6p 6e2f8ea 6e2f8ea5ac2f544c58938555a06ef21a4ecb032a 2015-03-17 17:39:55
我的 Xamarin Studio 版本是 5.9.7 (build 9)。
Xamarin says这是 Objective Sharpie 的一个错误,所以他们很快就会发布一个新版本。
我在-c argument
后面加上-xobjective-c
就可以生成绑定成功了。
像这样的东西:
sharpie bind -output Binding -sdk iphoneos9.2 -scope build/Headers build/Headers/Example/Example.h -c -xobjective-c -Ibuild/Headers -arch arm64
我的 Sharpie 版本是 3.0.8。