0

I was building Python (3.4 dev version) from source as a framework on OS X 10.8. I'm a relative newbie to Mac OS X internals and couldn't figure out why the OS X framework headers caused these errors. Can someone please give me some pointers?

I use the latest version of GNU gcc on my mac instead of the Apple supplied LLVM compiler. Perhaps, that's causing a compatibility problem.

gcc -Wno-unused-result -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -o FileSettings.o -c ./FileSettings.m
In file included from /System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:123:0,
                 from ./FileSettings.h:9,
                 from ./FileSettings.m:9:
/System/Library/Frameworks/Foundation.framework/Headers/NSTask.h:69:24: error: expected identifier or ‘(’ before ‘^’ token
 @property (copy) void (^terminationHandler)(NSTask *) NS_AVAILABLE(10_7, NA);
                        ^
/System/Library/Frameworks/Foundation.framework/Headers/NSTask.h:72:1: error: expected identifier before ‘end’
 @end
 ^
In file included from /System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:159:0,
                 from ./FileSettings.h:9,
                 from ./FileSettings.m:9:
/System/Library/Frameworks/Foundation.framework/Headers/NSUserScriptTask.h:36:15: error: expected identifier or ‘(’ before ‘^’ token
 typedef void (^NSUserScriptTaskCompletionHandler)(NSError *error);
               ^
/System/Library/Frameworks/Foundation.framework/Headers/NSUserScriptTask.h:37:1: error: unknown type name ‘NSUserScriptTaskCompletionHandler’
 - (void)executeWithCompletionHandler:(NSUserScriptTaskCompletionHandler)handler;
 ^
/System/Library/Frameworks/Foundation.framework/Headers/NSUserScriptTask.h:53:15: error: expected identifier or ‘(’ before ‘^’ token
 typedef void (^NSUserUnixTaskCompletionHandler)(NSError *error);
               ^
/System/Library/Frameworks/Foundation.framework/Headers/NSUserScriptTask.h:54:1: error: unknown type name ‘NSUserUnixTaskCompletionHandler’
 - (void)executeWithArguments:(NSArray *)arguments completionHandler:(NSUserUnixTaskCompletionHandler)handler;
 ^
/System/Library/Frameworks/Foundation.framework/Headers/NSUserScriptTask.h:68:15: error: expected identifier or ‘(’ before ‘^’ token
 typedef void (^NSUserAppleScriptTaskCompletionHandler)(NSAppleEventDescriptor *result, NSError *error);
               ^
/System/Library/Frameworks/Foundation.framework/Headers/NSUserScriptTask.h:69:1: error: unknown type name ‘NSUserAppleScriptTaskCompletionHandler’
 - (void)executeWithAppleEvent:(NSAppleEventDescriptor *)event completionHandler:(NSUserAppleScriptTaskCompletionHandler)handler;
 ^
/System/Library/Frameworks/Foundation.framework/Headers/NSUserScriptTask.h:86:15: error: expected identifier or ‘(’ before ‘^’ token
 typedef void (^NSUserAutomatorTaskCompletionHandler)(id result, NSError *error);
               ^
/System/Library/Frameworks/Foundation.framework/Headers/NSUserScriptTask.h:87:1: error: unknown type name ‘NSUserAutomatorTaskCompletionHandler’
 - (void)executeWithInput:(id <NSSecureCoding>)input completionHandler:(NSUserAutomatorTaskCompletionHandler)handler;
 ^
In file included from /System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:160:0,
                 from ./FileSettings.h:9,
                 from ./FileSettings.m:9:
/System/Library/Frameworks/Foundation.framework/Headers/NSXPCConnection.h:46:11: error: expected identifier or ‘(’ before ‘^’ token
     void (^_interruptionHandler)();
           ^
make[2]: *** [FileSettings.o] Error 1
make[1]: *** [install_PythonLauncher] Error 2
make: *** [frameworkinstallapps] Error 2
4

1 回答 1

0

这些错误与 Apple 为C、C++ 和 Objective-C 语言开发的“块”扩展完全对应。GCC(GNU 版本)无法识别块的出现和抱怨。

于 2013-07-28T19:50:29.210 回答