ine*_*tus 8 xcode header-files macos-catalina
我刚刚安装了 macOS Catalina 10.15 GM。不幸的是,我的应用程序框架都无法编译。找不到系统头文件。在 macOS Mojave 上有一个变通方法,但它不再有效,文件不会被下载(变通方法在这里解释)
键入时xcrun --show-sdk-path,/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk会打印在终端上。此文件夹还包含所有必需的标题。我如何告诉 Xcode 使用这些文件?
这是我的 module.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 *
}
Run Code Online (Sandbox Code Playgroud)
错误: Header '/usr/include/sys/socketvar.h' not found
您可以将 CPATH 设置为头目录。
export CPATH="/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/"
Run Code Online (Sandbox Code Playgroud)
为了解决这个问题,我只是将完整路径添加到模块映射中。如果有更好的方法,请告诉我,但至少现在文件可以编译(我还必须重新排序条目):
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_fsm.h"
header "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/netinet/tcp_var.h"
header "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/netinet/tcpip.h"
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 *
}
Run Code Online (Sandbox Code Playgroud)