[Buildroot] [PATCH] owfs: remove include of rpc/netdb.h

Arnout Vandecappelle (Essensium/Mind) arnout at mind.be
Wed Mar 9 22:48:25 UTC 2016


owfs carries a copy of netdb.h from an old glibc, which is only used
to implement getaddrinfo on platforms that miss it (Solaris 7 in
particular). Since all of our libc implementations have getaddrinfo,
we don't need it.

To make the patch minimal, just include if !HAVE_GETADDRINFO.

Fixes:
http://autobuild.buildroot.net/results/d9e918c2791cd5523b2fd6478bbd4ce21e58f4f1
http://autobuild.buildroot.net/results/3a85144753e4f18491d62dccf6d5843170f8daea

Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout at mind.be>
---
 ...t.h-only-include-compat_netdb.h-if-needed.patch | 58 ++++++++++++++++++++++
 1 file changed, 58 insertions(+)
 create mode 100644 package/owfs/0002-compat.h-only-include-compat_netdb.h-if-needed.patch

diff --git a/package/owfs/0002-compat.h-only-include-compat_netdb.h-if-needed.patch b/package/owfs/0002-compat.h-only-include-compat_netdb.h-if-needed.patch
new file mode 100644
index 0000000..7ae7932
--- /dev/null
+++ b/package/owfs/0002-compat.h-only-include-compat_netdb.h-if-needed.patch
@@ -0,0 +1,58 @@
+From d24e63eea4f4d234f313145e40668a5e2f64e49c Mon Sep 17 00:00:00 2001
+From: "Arnout Vandecappelle (Essensium/Mind)" <arnout at mind.be>
+Date: Wed, 9 Mar 2016 23:20:11 +0100
+Subject: [PATCH] compat.h: only include compat_netdb.h if needed
+
+compat_netdb.h is added for only one reason: to provide the definitions
+for getaddrinfo, in case it is not provided by the system.
+compat_netdb.h is just a copy from an old glibc version, but that makes
+it incompatible with other standard C libraries. For example, uClibc
+without RPC support doesn't have the rpc/netdb.h header. This leads to
+build errors.
+
+To work around this, only include compat_netdb.h when needed, i.e.
+when getaddrinfo isn't provided natively.
+
+Note that this getaddrinfo compat was introduced in commit bc54c431 to
+support Solaris 7. Starting from Solaris 8, however, getaddrinfo is
+available natively, and it's available on MacOS, Windows and any other
+POSIX-2001 compliant system as well. So it may be worhtwhile to remove
+it altogether.
+
+Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout at mind.be>
+---
+ module/owlib/src/include/compat.h   | 2 ++
+ module/ownet/c/src/include/compat.h | 2 ++
+ 2 files changed, 4 insertions(+)
+
+diff --git a/module/owlib/src/include/compat.h b/module/owlib/src/include/compat.h
+index c55bc96..e95e16f 100644
+--- a/module/owlib/src/include/compat.h
++++ b/module/owlib/src/include/compat.h
+@@ -57,7 +57,9 @@
+ #include <features.h>
+ #endif
+ 
++#ifndef HAVE_GETADDRINFO
+ #include "compat_netdb.h"
++#endif
+ #include "compat_getopt.h"
+ 
+ #ifndef HAVE_STRSEP
+diff --git a/module/ownet/c/src/include/compat.h b/module/ownet/c/src/include/compat.h
+index c45d852..f8ae759 100644
+--- a/module/ownet/c/src/include/compat.h
++++ b/module/ownet/c/src/include/compat.h
+@@ -58,7 +58,9 @@ $Id$
+ #include <features.h>
+ #endif
+ 
++#ifndef HAVE_GETADDRINFO
+ #include "compat_netdb.h"
++#endif
+ #include "compat_getopt.h"
+ 
+ #ifndef HAVE_STRSEP
+-- 
+2.7.0
+
-- 
2.7.0



More information about the buildroot mailing list