libnl: Fix build with musl
PATCH 1/1 libnl: Fix build with musl
From: Ming Liu <[email protected]>
[YOCTO #10313]
--- .../libnl/libnl/0001-Fix-build-with-musl.patch | 43 ++++++++++++++++++++++ meta/recipes-support/libnl/libnl_3.2.28.bb | 1 + 2 files changed, 44 insertions(+) create mode 100644 meta/recipes-support/libnl/libnl/0001-Fix-build-with-musl.patch
meta/recipes-support/libnl/libnl/0001-Fix-build-with-musl.patch new file +43 -0
@@ -0,0 +1,43 @@ +From 963d9818d13a025b857380c84d53b11c3aceff54 Mon Sep 17 00:00:00 2001 +From: Peter Liu <[email protected]> +Date: Wed, 21 Sep 2016 09:07:12 +0200 +Subject: [PATCH] Fix build with musl + +Upstream-Status: Pending + +Due to both <netinet/in.h> and <linux/in6.h> being included, the +in6_addr is being redefined: once from the C library headers and once +from the kernel headers. This causes some build failures with for +example the musl C library: +| In file included from ../../libnl-3.2.28/include/linux-private/linux/if_bridge.h:18:0, +| from ../../libnl-3.2.28/lib/route/link/bridge.c:26: +| /mnt/ale-build/tmp/musl/sysroots/itmk2/usr/include/linux/in6.h:32:8: error: redefinition of 'struct in6_addr' +| struct in6_addr { +| ^~~~~~~~ +| In file included from /mnt/ale-build/tmp/musl/sysroots/itmk2/usr/include/arpa/inet.h:9:0, +| from ../../libnl-3.2.28/include/netlink-private/netlink.h:33, +| from ../../libnl-3.2.28/lib/route/link/bridge.c:20: +| /mnt/ale-build/tmp/musl/sysroots/itmk2/usr/include/netinet/in.h:23:8: note: originally defined here + +In order to fix this, use just the C library header <netinet/in.h>. + +Signed-off-by: Peter Liu <[email protected]> +--- + include/linux-private/linux/if_bridge.h | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/include/linux-private/linux/if_bridge.h b/include/linux-private/linux/if_bridge.h +index f24050b..8f7490c 100644 +--- a/include/linux-private/linux/if_bridge.h ++++ b/include/linux-private/linux/if_bridge.h +@@ -15,7 +15,6 @@ + + #include <linux/types.h> + #include <linux/if_ether.h> +-#include <linux/in6.h> + + #define SYSFS_BRIDGE_ATTR "bridge" + #define SYSFS_BRIDGE_FDB "brforward" +-- +1.9.1 +
meta/recipes-support/libnl/libnl_3.2.28.bb +1 -0
@@ -15,6 +15,7 @@ SRC_URI = "https://github.com/thom311/${BPN}/releases/download/${BPN}${@d.getVar file://0001-lib-add-utility-function-nl_strerror_l.patch \ file://0002-lib-switch-to-using-strerror_l-instead-of-strerror_r.patch \ file://0003-src-switch-to-using-strerror_l-instead-of-strerror_r.patch \ + file://0001-Fix-build-with-musl.patch \ " UPSTREAM_CHECK_URI = "https://github.com/thom311/${BPN}/releases"
Signature · 1 line
1.9.1
Quoted 46 lines · Ming Liu
From: Ming Liu <[email protected]>
[YOCTO #10313]
Signed-off-by Ming Liu <[email protected]>---
.../libnl/libnl/0001-Fix-build-with-musl.patch | 43
++++++++++++++++++++++
meta/recipes-support/libnl/libnl_3.2.28.bb | 1 +2 files changed, 44 insertions(+)create mode 100644 meta/recipes-support/libnl/libnl/0001-Fix-build-with- musl.patch
(quoted diff) +0
-0musl.patch b/meta/recipes-support/libnl/libnl/0001-Fix-build-with- musl.patch
new file mode 100644
index 0000000..8a2dad5meta/recipes-support/libnl/libnl/0001-Fix-build-with-musl.patch new file +12
-0@@ -0,0 +1,43 @@ +From 963d9818d13a025b857380c84d53b11c3aceff54 Mon Sep 17 00:00:00 2001 +From: Peter Liu <[email protected]> +Date: Wed, 21 Sep 2016 09:07:12 +0200 +Subject: [PATCH] Fix build with musl + +Upstream-Status: Pending + +Due to both <netinet/in.h> and <linux/in6.h> being included, the +in6_addr is being redefined: once from the C library headers and once +from the kernel headers. This causes some build failures with for +example the musl C library: +| In file included from ../../libnl-3.2.28/include/linux-
private/linux/if_bridge.h:18:0,
+| from../../libnl-3.2.28/lib/route/link/bridge.c:26:
+|/mnt/ale-build/tmp/musl/sysroots/itmk2/usr/include/linux/in6.h:32:8:
error: redefinition of 'structin6_addr'+| struct in6_addr { +| ^~~~~~~~ +| In file included from /mnt/ale-
build/tmp/musl/sysroots/itmk2/usr/include/arpa/inet.h:9:0, +| from ../../libnl-3.2.28/include/netlink-private/netlink.h:33,
+| from../../libnl-3.2.28/lib/route/link/bridge.c:20:
+|/mnt/ale-build/tmp/musl/sysroots/itmk2/usr/include/netinet/in.h:23:8:
note: originally defined here
meta/recipes-support/libnl/libnl/0001-Fix-build-with-musl.patch
Quoted 2 lines
meta/recipes-support/libnl/libnl/0001-Fix-build-with-musl.patch new file +2
-0+ +In order to fix this, use just the C library header <netinet/in.h>.
This doesn't look right, as this error shouldn't happen (and I don't see it myself).
As per linux kernel commit cfd280c91253cc28e4919e349fa7a813b63e71e8, sysroot/usr/include/linux/in6.h guards definition of struct in6_addr with __UAPI_DEF_IN6_ADDR wich is set appropriately as per sysroot/usr/include/linux/libc-compat.h. Same for all the other structs. You can double check when compiling bridge.c manually using gcc's -E option.
Are you using a very old kernel or very old kernel headers? Older than 3.12?
Cheers,
Andre'
Quoted 41 lines
meta/recipes-support/libnl/libnl/0001-Fix-build-with-musl.patch new file +7
-0+ +Signed-off-by: Peter Liu <[email protected]> +--- + include/linux-private/linux/if_bridge.h | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/include/linux-private/linux/if_bridge.h b/include/linux-
private/linux/if_bridge.hmeta/recipes-support/libnl/libnl/0001-Fix-build-with-musl.patch new file +14
-0+index f24050b..8f7490c 100644 +--- a/include/linux-private/linux/if_bridge.h ++++ b/include/linux-private/linux/if_bridge.h +@@ -15,7 +15,6 @@ + + #include <linux/types.h> + #include <linux/if_ether.h> +-#include <linux/in6.h> + + #define SYSFS_BRIDGE_ATTR "bridge" + #define SYSFS_BRIDGE_FDB "brforward" +-- +1.9.1 +meta/recipes- renamed from meta/recipes-support/libnl/libnl_3.2.28.bb +0
-0support/libnl/libnl_3.2.28.bb
index 26982f3..f8f3e53 100644meta/recipes-support/libnl/libnl_3.2.28.bb +0
-0@@ -15,6 +15,7 @@ SRC_URI = "https://github.com/thom311/${BPN}/releases/download/${BPN}${@d.getVar file://0001-lib-add-utility-function-nl_strerror_l.patch \
file://0002-lib-switch-to-using-strerror_l-instead-of- strerror_r.patch \
file://0003-src-switch-to-using-strerror_l-instead-of- strerror_r.patch \
+ file://0001-Fix-build-with-musl.patch \
"
UPSTREAM_CHECK_URI = "https://github.com/thom311/${BPN}/releases"
--
1.9.1