gpt4 book ai didi

ios - Xcode 9 模块循环依赖 : Darwin -> std -> Darwin

转载 作者:行者123 更新时间:2023-12-01 18:05:33 26 4
gpt4 key购买 nike

自从在 Xcode 9(以前的 8.2)中打开我的项目以来,几个静态库和框架目标无法编译并出现大量错误。这个循环依赖错误总是在顶部。

一个例子是 libzip 的静态库目标。问题源于系统 zlib 库的单个 #include:

#include <zlib.h>

大多数目标可以通过禁用模块来解决这个问题 使用build设置启用模块(C 和 Objective-C)。

我有一个定义了几个模块的 Swift/C 框架,这不是一个解决方案。

许多错误与 tgmath.h 有关。 ,这在使用模块方面有些臭名昭著。我不确定为什么 tgmath 甚至被包括在内 - 它在 Darwin 模块图中被标记为显式。我很想检查 <module-includes>:28但我不确定如何。

这是编译错误的示例。有人知道如何在 Xcode 9 中解决这个问题吗?

While building module 'zlib' imported from /Users/.../lib/zipint.h:40:
While building module 'Darwin' imported from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/stddef.h:46:
While building module 'std' imported from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.0.sdk/usr/include/tgmath.h:31:
In file included from <module-includes>:1:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/ctype.h:39:15: fatal error: cyclic dependency in module 'Darwin': Darwin -> std -> Darwin
#include_next <ctype.h>
^
1 error generated.
While building module 'zlib' imported from /Users/.../lib/zipint.h:40:
While building module 'Darwin' imported from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/stddef.h:46:
In file included from <module-includes>:28:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/9.0.0/include/tgmath.h:37:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.0.sdk/usr/include/tgmath.h:31:10: fatal error: could not build module 'std'
#include <complex.h>
~~~~~~~~^
2 errors generated.
While building module 'zlib' imported from /Users/.../lib/zipint.h:40:
In file included from <module-includes>:1:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.0.sdk/usr/include/zlib.h:34:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.0.sdk/usr/include/zconf.h:247:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/stddef.h:46:15: fatal error: could not build module 'Darwin'
#include_next <stddef.h>
~~~~~~~~~~~~~^
3 errors generated.
In file included from /Users/.../lib/zip_get_compression_implementation.c:36:
/Users/.../lib/zipint.h:40:10: fatal error: could not build module 'zlib'
#include <zlib.h>
~~~~~~~~^
4 errors generated.

最佳答案

最后的问题是遗留的自定义标题搜索路径。它对 SDK 有一个明确的引用,XcodeDefault.xctoolchain/usr/include/c++/v1 .在搜索路径中包含这些 header 会破坏依赖循环保护。

关于ios - Xcode 9 模块循环依赖 : Darwin -> std -> Darwin,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46271892/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com