问题描述
我正在使用Fastlane发布应用程序。用于构建应用程序的xcodebuild命令的简化版本是这样的:
xcodebuild -workspace App.xcworkspace -scheme App
-configuration Release -sdk iphoneos13.6
-destination 'generic/platform=iOS' clean archive
这无法给出(添加示例):
/Library/Developer/CommandLinetools/SDKs/MacOSX.sdk/usr/include/sys/cdefs.h:807:2: error: Unsupported architecture
#error Unsupported architecture
^
In file included from /Users/sudeepkumar/Zendrive/mobile-apps/ios/copilot/Pods/glog/src/symbolize.cc:55:
In file included from /Users/sudeepkumar/Zendrive/mobile-apps/ios/copilot/Pods/glog/src/utilities.h:73:
In file included from /Users/sudeepkumar/Zendrive/mobile-apps/ios/copilot/Pods/glog/src/base/mutex.h:141:
In file included from /Library/Developer/CommandLinetools/SDKs/MacOSX.sdk/usr/include/pthread.h:55:
In file included from /Library/Developer/CommandLinetools/SDKs/MacOSX.sdk/usr/include/_types.h:27:
In file included from /Library/Developer/CommandLinetools/SDKs/MacOSX.sdk/usr/include/sys/_types.h:33:
/Library/Developer/CommandLinetools/SDKs/MacOSX.sdk/usr/include/machine/_types.h:34:2: error: architecture not supported
#error architecture not supported
^
我看到它正在选择MacOSX.sdk,我希望它会选择Xcode目录中存在的iPhoneOS sdk。这是失败的原因吗?还是其他?
xcrun输出:
» xcrun --show-sdk-platform-path
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform
» xcrun --sdk iphoneos --show-sdk-platform-path
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform
解决方法
Xcode正在/Library/CommandLineTools
中使用SDK。相反,它应该在Xcode应用程序内部使用它们。运行
xcode-select -r
或
xcode-select -s "/Applications/Xcode.app/Contents/Developer"
验证人
xcode-select -p
其中一些人可能需要sudo
。
xcodebuild -workspace App.xcworkspace -scheme App
-configuration Release -sdk iphoneos
-destination 'generic/platform=iOS' clean archive
在xcodebuild
man page
-sdk [<sdkfullpath> | <sdkname>]
Build an Xcode project or workspace against the specified SDK,using build tools appropriate for that SDK. The argument may be an
absolute path to an SDK,or the canonical name of an SDK.
- 使用
xcrun --sdk iphoneos --show-sdk-path
检查SDK路径。 - 检查Mac中的SDK。在我的Mac中,有
iPhoneOS.sdk
和iPhoneOS13.7.sdk
-
iPhoneOS13.7.sdk
是一个符号链接,其起源是iPhoneOS.sdk
。
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.7.sdk
此外,
- 您还可以使用
xcodebuild -showsdks
查看所有sdks - 不同设备的不同参数
- iOS:
-sdk iphoneos
- 模拟器:
-sdk iphonesimulator
- watchOS:
-sdk watchos
- macOS:
-sdk macosx
- iOS: