【问题标题】:XCode Build Error - missing required module 'Algorithms'XCode 构建错误 - 缺少必需的模块“算法”
【发布时间】:2021-06-18 18:38:44
【问题描述】:

背景

  1. 我试图将旧项目从 xcode 11.3 升级到 xcode 12.4。代码仍在 Swift 4.2 上
  2. 当尝试构建(任何 iOS 设备 - arm64)时,项目中的每个 swift 文件都出现相同的错误:
 <unknown\>:0: error: missing required module '**Algorithms**'

3.尝试使用xcode 11.3重建后,我发现arm64-apple-ios.swiftinterface实际上是在文件@987654322的顶部添加import 'Algorithms' @

//swift-interface-format-version: 1.0
// swift-compiler-version: Apple Swift 版本 5.3.1 (swiftlang-1200.8.41 clang-1200.0.32.8)
// swift-module-flags: -target arm64-apple-ios9.0 -enable-objc-interop -enable-librar -swift-version 5 -enforce-exclusivi 检查 -Onone -module-name 图表
导入算法
@_exported 导入图表
导入核心图形

问题

  • 如何将这个algorithms.h添加到项目/编译过程中,使项目能够编译?

  • 是什么导致编译器添加这个?是因为构建设置 > Swift 语言版本 > Swift 4.2 吗?

我的尝试

  • 重新安装 XCode 命令行工具 12.4
  • 构建设置->Apple Clang - 语言-C++ ->C++ 标准库(libc++) 参考:[https://stackoverflow.com/questions/25649385/algorithm-file-not-found]

【问题讨论】:

    标签: ios swift xcode build-error


    【解决方案1】:

    问题现在解决了。

    似乎我们正在使用的库之一依赖于新的“算法”Swift (https://github.com/apple/swift-algorithms)。因此我们可以通过两种方式解决

    • 将 Algorithms Swift 依赖项添加到项目中
    • 在使用 Swift 算法之前将库还原为

    谢谢。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2017-03-23
      • 1970-01-01
      • 2020-09-04
      • 1970-01-01
      • 1970-01-01
      • 2018-04-25
      • 1970-01-01
      相关资源
      最近更新 更多