]> granicus.if.org Git - libnl/commitdiff
FTBFS with musl libc: Missing includes
authorIsaac <ibid_ag@lavabit.com>
Sun, 13 May 2012 05:37:48 +0000 (22:37 -0700)
committerThomas Graf <tgraf@redhat.com>
Sun, 13 May 2012 09:18:28 +0000 (11:18 +0200)
Hello,
libnl 3.2.9 does not build with musl libc, without patching.
I' using a current musl libc (http://www.etalabs.net/musl/)
with linux 2.6.32 headers.
At first there were a couple problems on the musl side, but those are
resolved.
However, I found some other issues:
First, two files were missing
#include <byteswap.h>:
lib/netfilter/log_msg.c
lib/netfilter/queue_msg.c
These files used __bswap_64 (which should be bswap_64), a macro
declared in byteswap.h

Second, I got this error after fixing that:

In file included from nf-queue.c:16:
./include/linux/netfilter.h:53: error: field in has incomplete type
./include/linux/netfilter.h:54: error: field in6 has incomplete type

I found that src/nf-queue.c is missing an
#include <netinet/in.h>

Attached is a patch which resolves these issues.  I've tested with both
musl and glibc, and it builds cleanly on both.

lib/netfilter/ct.c
lib/netfilter/log_msg.c
lib/netfilter/queue_msg.c
src/nf-queue.c

index 9d61b6cd84958aa656aa0a2103a8b9a328703158..59ee1d950479fb3c683807ee75f6cbf1c927126f 100644 (file)
@@ -38,7 +38,7 @@ static uint64_t ntohll(uint64_t x)
 #elif __BYTE_ORDER == __LITTLE_ENDIAN
 static uint64_t ntohll(uint64_t x)
 {
-       return __bswap_64(x);
+       return bswap_64(x);
 }
 #endif
 
index cad6ddd059105b36076c6473874c4a601ea0201c..65448f97397d0ee38aefd77929d50cb926c8d790 100644 (file)
@@ -26,6 +26,7 @@
 #include <netlink/attr.h>
 #include <netlink/netfilter/nfnl.h>
 #include <netlink/netfilter/log_msg.h>
+#include <byteswap.h>
 
 #if __BYTE_ORDER == __BIG_ENDIAN
 static uint64_t ntohll(uint64_t x)
@@ -35,7 +36,7 @@ static uint64_t ntohll(uint64_t x)
 #elif __BYTE_ORDER == __LITTLE_ENDIAN
 static uint64_t ntohll(uint64_t x)
 {
-       return __bswap_64(x);
+       return bswap_64(x);
 }
 #endif
 
index c40f8c216573221b439902200d06aa55f5754764..30c522fb2fb8a6a4289661870d151fd250b2d05f 100644 (file)
@@ -24,6 +24,7 @@
 #include <netlink/attr.h>
 #include <netlink/netfilter/nfnl.h>
 #include <netlink/netfilter/queue_msg.h>
+#include <byteswap.h>
 
 static struct nl_cache_ops nfnl_queue_msg_ops;
 
@@ -35,7 +36,7 @@ static uint64_t ntohll(uint64_t x)
 #elif __BYTE_ORDER == __LITTLE_ENDIAN
 static uint64_t ntohll(uint64_t x)
 {
-       return __bswap_64(x);
+       return bswap_64(x);
 }
 #endif
 
index bd10adfdcfa8f9517ac2063870c904f24f9f2329..922d9c8e9c8bea9bdefdce5ab9740b01ccf978bd 100644 (file)
@@ -13,6 +13,7 @@
 
 #include <netlink/cli/utils.h>
 #include <netlink/cli/link.h>
+#include <netinet/in.h>
 #include <linux/netfilter.h>
 #include <linux/netfilter/nfnetlink_queue.h>
 #include <netlink/netfilter/nfnl.h>