UIKit/UIKit.h 未找到 clang building Mac Catalyst
UIKit/UIKit.h not found for clang building Mac Catalyst
我正在为 Mac Catalyst 构建静态 iOS/macOS 库,使用以下标志:
clang \
--target=x86_64-apple-ios13-macabi \
-isysroot /Applications/Xcode_11.3.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk
这会构建 vanilla 源文件,但失败了:
#if TARGET_OS_IPHONE || TARGET_OS_SIMULATOR
#import <UIKit/UIKit.h>
#endif
由于定义了 TARGET_OS_IPHONE,看起来目标标志正在工作。但是,找不到 UIKit/UIKit.h,即使它在 SDK 中:
$ find -L /Applications/Xcode_11.3.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk -name UIKit.h
/Applications/Xcode_11.3.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/iOSSupport/System/Library/Frameworks/UIKit.framework/Versions/A/Headers/UIKit.h
/Applications/Xcode_11.3.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/iOSSupport/System/Library/Frameworks/UIKit.framework/Versions/Current/Headers/UIKit.h
/Applications/Xcode_11.3.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/iOSSupport/System/Library/Frameworks/UIKit.framework/Headers/UIKit.h
我需要明确指定 UIKit 框架吗?
使这项工作成功的双重秘密构建设置是:
FAT_LIB_MAC_CATALYST_FLAGS = -arch x86_64h \
--target=x86_64-apple-ios13-macabi \
-isysroot $(MACOSX_SDK_DIR) \
-isystem $(MACOSX_SDK_DIR)/System/iOSSupport/usr/include \
-iframework $(MACOSX_SDK_DIR)/System/iOSSupport/System/Library/Frameworks
我正在为 Mac Catalyst 构建静态 iOS/macOS 库,使用以下标志:
clang \
--target=x86_64-apple-ios13-macabi \
-isysroot /Applications/Xcode_11.3.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk
这会构建 vanilla 源文件,但失败了:
#if TARGET_OS_IPHONE || TARGET_OS_SIMULATOR
#import <UIKit/UIKit.h>
#endif
由于定义了 TARGET_OS_IPHONE,看起来目标标志正在工作。但是,找不到 UIKit/UIKit.h,即使它在 SDK 中:
$ find -L /Applications/Xcode_11.3.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk -name UIKit.h
/Applications/Xcode_11.3.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/iOSSupport/System/Library/Frameworks/UIKit.framework/Versions/A/Headers/UIKit.h
/Applications/Xcode_11.3.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/iOSSupport/System/Library/Frameworks/UIKit.framework/Versions/Current/Headers/UIKit.h
/Applications/Xcode_11.3.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/iOSSupport/System/Library/Frameworks/UIKit.framework/Headers/UIKit.h
我需要明确指定 UIKit 框架吗?
使这项工作成功的双重秘密构建设置是:
FAT_LIB_MAC_CATALYST_FLAGS = -arch x86_64h \
--target=x86_64-apple-ios13-macabi \
-isysroot $(MACOSX_SDK_DIR) \
-isystem $(MACOSX_SDK_DIR)/System/iOSSupport/usr/include \
-iframework $(MACOSX_SDK_DIR)/System/iOSSupport/System/Library/Frameworks