gpt4 book ai didi

swift - 切换到 macOS Catalina 后,Modulemap 将无法编译 - tcp_var.h

转载 作者:行者123 更新时间:2023-11-30 10:34:55 25 4
gpt4 key购买 nike

我是一个跟踪网络速度的小工具的开发人员。该代码驻留在一个使用模块映射的小框架中,因此我可以在 Swift 中使用 C 代码。

这是我的(旧)模块图:

module PrivateNetwork [system]
{
header "/usr/include/sys/socketvar.h"
header "/usr/include/net/if_dl.h"
header "/usr/include/net/if_types.h"
header "/usr/include/net/if.h"
header "/usr/include/netinet/in.h"
header "/usr/include/netinet/tcp.h"

header "/usr/include/netinet/tcp_var.h"
header "/usr/include/netinet/tcpip.h"
header "/usr/include/netinet/tcp_fsm.h"
header "/usr/include/netinet/ip.h"
header "/usr/include/netinet/ip6.h"

export *
}

切换到 macOS Catalina 后,不再找到/usr/include/文件夹,因此我必须更改它们:

module PrivateNetwork [system]
{
header "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/socketvar.h"

header "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/netinet/ip.h"
header "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/netinet/ip6.h"

header "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/netinet/tcp.h"
header "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/netinet/tcp_fsm.h"
header "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/netinet/tcp_var.h" // > ip.h (in_addr), > tcp.h (tcp_seq)
header "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/netinet/tcpip.h" // > ip.h (in_addr)

header "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/net/if_types.h"
header "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/net/if.h"
header "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/net/if_dl.h"

export *
}

我已经做了一些更改,因为添加完整路径后,模块映射不再编译。我收到以下错误:

在需要之前,必须从模块“Darwin.POSIX.netinet.tcp”导入“tcp_seq”声明

完整版:/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/netinet/tcp_var.h:120:2:必须导入“tcp_seq”声明在需要之前从模块“Darwin.POSIX.netinet.tcp”中获取

我不明白这一点,因为定义结构的头 tcp.h 是在 tcp_var.h 头之前导入的。

我该如何解决这个问题?

最佳答案

我删除了 tcp.h header 导入,现在它可以编译了。

关于swift - 切换到 macOS Catalina 后,Modulemap 将无法编译 - tcp_var.h,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58239867/

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