Skip to content

Commit

Permalink
deps: fix building with system c-ares on Linux
Browse files Browse the repository at this point in the history
The change in nodejs#39724 breaks building with system c-ares (`--shared-cares`):
```
In file included from ../src/cares_wrap.cc:25:
../src/cares_wrap.h:25:11: fatal error: ares_nameser.h: No such file or directory
   25 | # include <ares_nameser.h>
      |           ^~~~~~~~~~~~~~~~
```

Since `ares_nameser.h` isn't available with a default system c-ares installation, let's add back the include check and use the old `arpa/nameser.h` routine instead.

Tested to build fine on Arch Linux with shared c-ares.
  • Loading branch information
felixonmars committed Aug 11, 2021
1 parent 4ece669 commit 3b60656
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/cares_wrap.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,15 @@
# include <netdb.h>
#endif // __POSIX__

#if defined(__ANDROID__) || \
defined(__MINGW32__) || \
defined(__OpenBSD__) || \
defined(_MSC_VER)

# include <ares_nameser.h>
#else
# include <arpa/nameser.h>
#endif

namespace node {
namespace cares_wrap {
Expand Down

0 comments on commit 3b60656

Please sign in to comment.