添加module.modulemap导致依赖关系中的循环

问题描述 投票:0回答:1

我有一个静态库C,其中包含obj-c和Swift代码。我的主应用程序目标A引用了此库。项目中还有许多其他依赖项和静态库。由于我将module.modulemap文件添加到我的静态库项目中,因此可以在主应用程序的Swift代码中使用它,因此该项目构建失败,并显示以下错误消息:

error: Cycle in dependencies between targets 'A' and 'C'; building could produce unreliable results. This usually can be resolved by moving the target's Headers build phase before Compile Sources.
Cycle path: A → B → C → A
Cycle details:
→ Target 'A' has target dependency on Target 'B'
→ Target 'B' has compile command for Swift source files
→ Target 'C' has copy command from 'path_to_project/Resources/module.modulemap' to 'path_to_build_folder/Build/Products/Debug-iphonesimulator/include/{ProjectName}/module.modulemap'
○ Target 'C' has compile command with input 'path_to_target_C/{ProjectName}/Somefile.mm'
○ Target 'C' has compile command for Swift source files

似乎是由于新的modulemap文件和我添加到我的静态库中的复制阶段所致,但无法确定为什么该复制阶段会添加依赖项循环。

我已按照swift-static-library-in-objective-c中提到的步骤添加了此支持。

提前感谢。

ios swift circular-dependency
1个回答
0
投票

要解决此问题,您需要转到Build Phases并将复制阶段复制到module.modulemap上方,复制Compile Sources

enter image description here

但是,仍然不清楚为什么首先要发生依赖。

© www.soinside.com 2019 - 2024. All rights reserved.