[英]Xcode 13 Swift Package Manager Dependency Command CompileSwiftSources failed with a nonzero exit code Error
[英]Swift Package Manager dependencies won't build: "Showing All Errors Only Command CompileSwiftSources failed with a nonzero exit code"
出於某種原因,每當我嘗試通過 SPM 更新我的依賴項時,都會出現構建錯誤。 我團隊中的其他人可以拿到很好的東西,出於某種原因,我有一台被詛咒的機器。 相同版本的 macOS,相同版本的 XCode,來自 git 的相同分支。
僅供參考 macOS Monterey 12.3.1 XCode 13.2.1
以下是我用來嘗試解決此問題的步驟。 因為我絕望了,所以我完全焦土了。
xcodebuild -resolvePackageDependencies -scheme *schemeName* -project *project*.xcodeproj -configuration Debug
完成以下操作后,我將打開 XCode 並嘗試運行,我遇到了同樣的錯誤。
這是構建日志:
Build target *InternalOBJCFramework* with configuration Debug
*removed*
Undefined symbols for architecture arm64:
"___llvm_profile_runtime", referenced from:
___llvm_profile_runtime_user in *InternalOBJCFramework*.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Build target Socket with configuration Debug
CompileSwiftSources normal arm64 com.apple.xcode.tools.swift.compiler (in target 'Socket' from project 'Socket')
*removed*
Command CompileSwiftSources failed with a nonzero exit code
Build target KeychainAccess with configuration Debug
CompileSwiftSources normal arm64 com.apple.xcode.tools.swift.compiler (in target 'KeychainAccess' from project 'KeychainAccess')
*removed*
error: jobFailedWithNonzeroExitCode(2, "")
Command CompileSwiftSources failed with a nonzero exit code
Build target BTree with configuration Debug
CompileSwiftSources normal arm64 com.apple.xcode.tools.swift.compiler (in target 'BTree' from project 'BTree')
*removed*
Command CompileSwiftSources failed with a nonzero exit code
Build target Rswift with configuration Debug
CompileSwiftSources normal arm64 com.apple.xcode.tools.swift.compiler (in target 'Rswift' from project 'R.swift.Library')
*removed*
Command CompileSwiftSources failed with a nonzero exit code
Build target CombineExt with configuration Debug
CompileSwiftSources normal arm64 com.apple.xcode.tools.swift.compiler (in target 'CombineExt' from project 'CombineExt')
*removed*
Command CompileSwiftSources failed with a nonzero exit code
Build target ReactiveSwift with configuration Debug
CompileSwiftSources normal arm64 com.apple.xcode.tools.swift.compiler (in target 'ReactiveSwift' from project 'ReactiveSwift')
*removed*
Command CompileSwiftSources failed with a nonzero exit code
Build target XCGLogger with configuration Debug
CompileSwiftSources normal arm64 com.apple.xcode.tools.swift.compiler (in target 'XCGLogger' from project 'XCGLogger')
*removed*
Command CompileSwiftSources failed with a nonzero exit code
讓我們使用他們說的SPM,他們說的會更容易。 🤦🏻♂️
問題發生在我引入的一個依賴項中,它的 package.swift 文件將自身定義為動態的。
// inside the package.swift file
platforms: [.iOS(.v13)],
products: [
.library(
// changing this to name: "PrivateLib" and removing type: .dynamic fixed the issue
name: "PrivateLib", type: .dynamic,
targets: ["PrivateLib"]
)
],
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.