c-ares: fatal error: 'os/availability.h' file not found building on Mac OS X 10.8 - 10.11

1.30.0 fails to build on Mac OS X 10.11:

In file included from /opt/local/var/macports/build/_opt_bblocal_var_buildworker_ports_build_ports_net_c-ares/c-ares/work/c-ares-1.30.0/src/lib/ares_sysconfig_mac.c:54:
/opt/local/var/macports/build/_opt_bblocal_var_buildworker_ports_build_ports_net_c-ares/c-ares/work/c-ares-1.30.0/src/lib/thirdparty/apple/dnsinfo.h:31:10: fatal error: 'os/availability.h' file not found
#include <os/availability.h>
         ^

There are similar reports for Mac OS X 10.8, Mac OS X 10.9 and Mac OS X 10.10.

It’s unclear whether c-ares still supports Mac OS X versions prior to 10.12, given discussion in issue #454, but if it’s possible, a fix for this would be appreciated. It may relate to reliance on clock_gettime, introduced in 10.12. Discussed at https://trac.macports.org/ticket/70207

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 62 (28 by maintainers)

Commits related to this issue

Most upvoted comments

Looks right to me.

Btw, when specifying an ip address, you’re likely meaning to use adig -t PTR 8.8.8.8 for a reverse lookup. That’s why all you got was an SOA record back since the query itself wasn’t technically valid.

Otherwise you could do a forward lookup like adig www.google.com

k, just joined that. I’m on as bradh352

ok, this is getting a bit more complicated unfortunately. dnsinfo.h that would correspond with 10.6 is https://opensource.apple.com/source/configd/configd-395.11/dnsinfo/dnsinfo.h

It does not have the reach_flags and if_name members of the dns_resolver_t structure.

The if_name can be worked around since we have if_index, but the reach_flags could be an issue.

@bradh352 I will test whatever needed locally, this is really important to have working. (Perhaps no trivial method for CI for macOS ppc, though it is possible to do via Rosetta on an x86 Mac.)

@bradh352 I will try building now and let you know.

Thank you very much for fixing this!

P. S. 1.29.0 was missed, since MacPorts skipped it.

I don’t see why we couldn’t back off to an earlier version of the dnsinfo.h header.