为 Linux 编译 mDNSResponder?
我一直在尝试编译Apple为Linux开发的开源Bonjour框架。我遇到的问题是,当我使用选项 os=linux 运行 make 时,出现以下编译错误:
struct sockaddr 没有名为“sa_len”的成员
我检查了 struct sockddr,它确实没有名为 sa_len 的成员...所以我很困惑为什么框架认为它应该这样做!
有人可以给我一些关于如何为 Linux 编译 mDNSResponder 的建议吗?非常感谢。
I've been trying to compile the open source Bonjour framework developed by Apple for Linux. The problem I have is that when I run make with the option os=linux
I get the following compile error:
struct sockaddr has no member named 'sa_len'
I've checked the struct sockddr and it indeed has no member named sa_len... So I'm confused as to why the framework is thinking that it should do!
Could anyone please give me some advice as to how I should be compiling mDNSResponder for Linux? Many thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
查看 mDNSUNP.h 可以发现,如果
sa_len
不存在(例如在 Linux 上),则应定义宏NOT_HAVE_SA_LEN
。如果您的情况未定义,请尝试将-DNOT_HAVE_SA_LEN
添加到您的编译标志中。Looking in mDNSUNP.h one can see that if
sa_len
does not exist (such as on Linux), a macroNOT_HAVE_SA_LEN
should be defined. If it's not defined in your case, try adding-DNOT_HAVE_SA_LEN
to your compilation flags.sockaddr 的 Linux 实现没有 sa_len 作为成员,但 FreeBSD 版本有。 Apple 的实现基于 FreeBSD 版本(OS X 的部分内容来自 FreeBSD 和 NetBSD ),这就是为什么您会收到该错误。您可以使用
#ifdef
来解决此问题或添加编译标志,如之前建议的那样。The Linux implementation of sockaddr doesn't have sa_len as a member, but the FreeBSD version does. Apple's implementation is based off of the FreeBSD version (parts of OS X pull from FreeBSD and NetBSD), hence why you're receiving that error. You can use an
#ifdef
to workaround it or add the compilation flag, as previously suggested.