I am the developer of a small tool that will track the network speed. This code resides in a small framework which sues a module map, so I can use the C code in Swift.
Here is my (old) modulemap:
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 *
}
After switching to macOS Catalina, the /usr/include/ folders were no longer found, so I had to change them:
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 *
}
I already made some changes, because after adding the full path, the modulemap no longer compiles. I get the following error:
Declaration of 'tcp_seq' must be imported from module 'Darwin.POSIX.netinet.tcp' before it is required
Full version:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/netinet/tcp_var.h:120:2: Declaration of 'tcp_seq' must be imported from module 'Darwin.POSIX.netinet.tcp' before it is required
.
I don't understand this, because the header tcp.h, where the struct is defined, is imported before the tcp_var.h header.
How can I fix this?