簡體   English   中英

Swift 包管理器依賴項不會構建:“僅顯示所有錯誤命令 CompileSwiftSources 失敗,退出代碼非零”

[英]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

  • 當我輸入這個時,我正在下載 13.3.1。

以下是我用來嘗試解決此問題的步驟。 因為我絕望了,所以我完全焦土了。

  • 關閉 Xcode
  • 從 Git 克隆新的倉庫
  • 刪除派生數據
  • 進入工作區並清除 package.resolve
    • 我遇到了一些問題,包裹解析被其他人簽到時搞砸了
    • 我試過不清除 package.resolve 並得到相同的結果
  • cd 進入終端的項目目錄
  • 通過命令行獲取依賴xcodebuild -resolvePackageDependencies -scheme *schemeName* -project *project*.xcodeproj -configuration Debug
    • 我也通過 xcode 做到了這一點,但這經常會卡住。

完成以下操作后,我將打開 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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM