Bug 10313

Summary: libnl fail to build with musl
Product: [Build System, Metadata & Runtime] OE-Core Reporter: Ming Liu <liu.ming50>
Component: coreAssignee: Ming Liu <liu.ming50>
Status: RESOLVED NOTABUG QA Contact:
Severity: normal    
Priority: Medium CC: meta.mr.watcher, meta.watcher, richard.purdie
Version: 2.3   
Target Milestone: 2.2 M4   
Hardware: x86   
OS: Multiple   
Whiteboard:
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: No (bug/feature does not impact docs)

Description Ming Liu 2016-09-21 06:53:02 UTC
I encountered following errors when build libnl with musl:

| 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
|  struct in6_addr {
|         ^~~~~~~~
| 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:49:8: error: redefinition of 'struct sockaddr_in6'
|  struct sockaddr_in6 {
|         ^~~~~~~~~~~~
| 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:34:8: note: originally defined here
|  struct sockaddr_in6 {
|         ^~~~~~~~~~~~
| 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:59:8: error: redefinition of 'struct ipv6_mreq'
|  struct ipv6_mreq {
|         ^~~~~~~~~
| 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:42:8: note: originally defined here
|  struct ipv6_mreq {
|         ^~~~~~~~~
| make[2]: *** [route/link/bridge.lo] Error 1
| make[2]: *** Waiting for unfinished jobs....
Comment 1 Richard Purdie 2016-09-22 14:52:18 UTC
I think we ran into this when upgrading to the new kernel and I refreshed the linux-libc-headers to resolve it. Which linux-libc-headers are you using?
Comment 2 Ming Liu 2016-09-23 07:45:53 UTC
I was building it with a linux 4.6 kernel(git://github.com/Freescale/linux-fslc.git), plus the following patches back-ported from linux-libc-headers 4.8 recipe:
 
SRC_URI_append_libc-musl = "\
    file://0001-libc-compat.h-fix-some-issues-arising-from-in6.h.patch \
    file://0002-libc-compat.h-prevent-redefinition-of-struct-ethhdr.patch \
    file://0003-remove-inclusion-of-sysinfo.h-in-kernel.h.patch \
   "
 
when I encountered that libnl compiling issue, but as you said, I might have done something wrong in my building environment, so I can double test it, will let you know if I find something new.
Comment 3 Ming Liu 2016-09-26 07:13:17 UTC
Hi,

I just re-tested it with the linux-libc-headers 4.8, the problem is not present with that, so maybe it's caused my wrong environment.

I am closing it, sorry for the noise.