Openembedded Core Discussions
 help / color / mirror / Atom feed
From: Adrian Bunk <bunk@stusta.de>
To: "Andreas Müller" <schnitzeltony@gmail.com>
Cc: Patches and discussions about the oe-core layer
	<openembedded-core@lists.openembedded.org>
Subject: Re: musl thoughts
Date: Mon, 25 Mar 2019 19:46:29 +0200	[thread overview]
Message-ID: <20190325174629.GA5805@localhost> (raw)
In-Reply-To: <CALbNGRThou+6CNKotr-hduJoKNPgg+F2i8PQdgjBGcGRZeOKdw@mail.gmail.com>

On Mon, Mar 25, 2019 at 06:15:40PM +0100, Andreas Müller wrote:
>...
> Looked into this. Found an old musl build failure of networkmanager
> [1] but I think the issue has not changed:
> 
> | In file included from
> TOPDIR/build/tmp/work/mips32r2-yoe-linux-musl/networkmanager/1.14.4-r0/recipe-sysroot/usr/include/net/ethernet.h:10,
> |                  from ../NetworkManager-1.14.4/shared/n-acd/src/n-acd.c:28:
> | TOPDIR/build/tmp/work/mips32r2-yoe-linux-musl/networkmanager/1.14.4-r0/recipe-sysroot/usr/include/netinet/if_ether.h:111:8:
> error: redefinition of 'struct ethhdr'
> |  struct ethhdr {
> |         ^~~~~~
> | In file included from ../NetworkManager-1.14.4/shared/n-acd/src/n-acd.c:26:
> | TOPDIR/build/tmp/work/mips32r2-yoe-linux-musl/networkmanager/1.14.4-r0/recipe-sysroot/usr/include/linux/if_ether.h:167:8:
> note: originally defined here
> | struct ethhdr {
> |         ^~~~~~
> 
> glibc does not fail because it does include linux header
> | /* Get definitions from kernel header file.  */
> | #include <linux/if_ether.h>
> and does not define struct ethhdr
> 
> linux/if_ether.h says:
> /* allow libcs like musl to deactivate this, glibc does not implement this. */
> #ifndef __UAPI_DEF_ETHHDR
> #define __UAPI_DEF_ETHHDR        1
> #endif
> 
> #if __UAPI_DEF_ETHHDR
> struct ethhdr {
>     unsigned char    h_dest[ETH_ALEN];    /* destination eth addr    */
>     unsigned char    h_source[ETH_ALEN];    /* source ether addr    */
>     __be16        h_proto;        /* packet type ID field    */
> } __attribute__((packed));
> #endif
> 
> musl does not include linux header but defines which is differen from
> what linux does:
> struct ethhdr {
>     uint8_t h_dest[ETH_ALEN];
>     uint8_t h_source[ETH_ALEN];
>     uint16_t h_proto;
> };
> and later
> #define __UAPI_DEF_ETHHDR       0
> 
> So for networkmanager there is either some wrong sequence or it
> includes linux headers.

musl headers providing own different definitions of kernel interfaces
is a problem in musl.

After reading [1] I think that this is musl upstream having made the 
decision of not even trying to work properly with the kernel headers.

OE adding a not upstreamable patch that removes one of the two 
definitions in musl builds might be the best available solution.

> And I am still not confident that it is our job to teach umpteen
> projects written for linux how to write portable code (oe-core has 147
> musl related patches and meta-openembedded has 140)...
>...

This is not about writing portable code, this is about problems with musl.

Using the Linux userspace headers is obviously not portable to non-Linux,
but many packages like NetworkManager are anyways Linux-only no matter 
what you do.

> Andreas

cu
Adrian

[1] https://wiki.musl-libc.org/faq.html#Q:-Why-am-I-getting-

-- 

       "Is there not promise of rain?" Ling Tan asked suddenly out
        of the darkness. There had been need of rain for many days.
       "Only a promise," Lao Er said.
                                       Pearl S. Buck - Dragon Seed



  parent reply	other threads:[~2019-03-25 17:46 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-22  1:11 musl thoughts Andreas Müller
2019-03-22 14:53 ` akuster808
2019-03-22 19:35   ` Adrian Bunk
2019-03-22 20:03 ` Adrian Bunk
2019-03-22 22:20   ` Khem Raj
2019-03-23 17:30     ` Adrian Bunk
2019-03-22 22:18 ` Khem Raj
2019-03-23 21:16   ` Adrian Bunk
2019-03-23 21:22     ` Andreas Müller
2019-03-23 21:53       ` Adrian Bunk
2019-03-23 22:00         ` Andreas Müller
2019-03-25 15:36           ` Andrea Adami
2019-03-25 16:10             ` Adrian Bunk
2019-03-25 16:26               ` Andreas Müller
2019-03-25 17:15                 ` Andreas Müller
2019-03-25 17:36                   ` Andreas Müller
2019-03-25 18:03                     ` Adrian Bunk
2019-03-25 19:46                       ` Andreas Müller
2019-03-25 17:46                   ` Adrian Bunk [this message]
2019-03-25 21:11                     ` Andreas Müller
2019-03-25 22:38                       ` Khem Raj
2019-03-25 16:31               ` Andrea Adami
2019-03-25 17:07                 ` Adrian Bunk
2019-03-25 17:44     ` Khem Raj
2019-03-25 18:23       ` Adrian Bunk
2019-03-25 15:46 ` Mark Hatle

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190325174629.GA5805@localhost \
    --to=bunk@stusta.de \
    --cc=openembedded-core@lists.openembedded.org \
    --cc=schnitzeltony@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox