首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >xcodebuild归档失败:选择了错误的SDK?

xcodebuild归档失败:选择了错误的SDK?
EN

Stack Overflow用户
提问于 2020-08-28 11:56:33
回答 2查看 484关注 0票数 1

我正在使用fastlane发布一个应用程序。用于构建应用程序的xcodebuild命令的简化版本如下:

代码语言:javascript
复制
xcodebuild -workspace App.xcworkspace -scheme App 
           -configuration Release -sdk iphoneos13.6 
           -destination 'generic/platform=iOS' clean archive

这不能给出(添加样本):

代码语言:javascript
复制
/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输出:

代码语言:javascript
复制
» 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
EN

回答 2

Stack Overflow用户

发布于 2020-08-31 18:53:33

Xcode正在使用/Library/CommandLineTools中的SDK。相反,它应该使用Xcode应用程序中的那些。跑

代码语言:javascript
复制
 xcode-select -r

代码语言:javascript
复制
xcode-select -s "/Applications/Xcode.app/Contents/Developer"

验证依据

代码语言:javascript
复制
xcode-select -p

其中一些可能需要sudo

票数 1
EN

Stack Overflow用户

发布于 2020-09-05 20:55:23

代码语言:javascript
复制
xcodebuild -workspace App.xcworkspace -scheme App 
           -configuration Release -sdk iphoneos
           -destination 'generic/platform=iOS' clean archive

xcodebuild man page

代码语言:javascript
复制
-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.

  1. 使用xcrun --sdk iphoneos --show-sdk-path检查SDK路径。
  2. 检查您的Mac中的SDK。在我的苹果电脑上,iPhoneOS13.7.sdk
  • iPhoneOS13.7.sdk是一个符号链接,它的原点是iPhoneOS.sdk

代码语言:javascript
复制
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.7.sdk

另外,

  • 您还可以使用xcodebuild -showsdks查看不同设备的所有参数
    • iOS:-sdk iphoneos
    • Simulator:-sdk iphonesimulator
    • watchOS:-sdk watchos
    • macOS:-sdk macosx
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/63627237

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档