Compiling mDNSResponder for Linux?
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 confu开发者_如何学编程sed 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.
Looking in mDNSUNP.h one can see that if sa_len
does not exist (such as on Linux), a macro NOT_HAVE_SA_LEN
should be defined. If it's not defined in your case, try adding -DNOT_HAVE_SA_LEN
to your compilation flags.
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.
精彩评论