diff mbox series

[1/1] sandbox: eth-raw: fix building with musl library

Message ID 20220121170123.363645-1-heinrich.schuchardt@canonical.com
State Accepted
Commit 8e72374feb08110e407e008b6d4a158158f9fcf1
Delegated to: Simon Glass
Headers show
Series [1/1] sandbox: eth-raw: fix building with musl library | expand

Commit Message

Heinrich Schuchardt Jan. 21, 2022, 5:01 p.m. UTC
The definition of struct udphdr in include netinet/udp.h in the
musl library differs from the definition in the glibc library.

To use the same definition with musl the symbol _GNU_SOURCE has
to be defined.

Reported-by: Milan P. Stanić <mps@arvanta.net>
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
---
 arch/sandbox/cpu/eth-raw-os.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Milan P. Stanić Jan. 21, 2022, 8:12 p.m. UTC | #1
Hi,

it works and build pass without error or warning.
Tested on alpine edge aarch64 bare metal.

Thank you

On Fri, 2022-01-21 at 18:01, Heinrich Schuchardt wrote:
> The definition of struct udphdr in include netinet/udp.h in the
> musl library differs from the definition in the glibc library.
> 
> To use the same definition with musl the symbol _GNU_SOURCE has
> to be defined.
> 
> Reported-by: Milan P. Stanić <mps@arvanta.net>
> Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>

Tested-by: Milan P. Stanić <mps@arvanta.net>

> ---
>  arch/sandbox/cpu/eth-raw-os.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/arch/sandbox/cpu/eth-raw-os.c b/arch/sandbox/cpu/eth-raw-os.c
> index 6a8d809756..e59b96be5f 100644
> --- a/arch/sandbox/cpu/eth-raw-os.c
> +++ b/arch/sandbox/cpu/eth-raw-os.c
> @@ -4,6 +4,8 @@
>   * Copyright (c) 2015-2018 Joe Hershberger <joe.hershberger@ni.com>
>   */
>  
> +#define _GNU_SOURCE
> +
>  #include <asm/eth-raw-os.h>
>  #include <errno.h>
>  #include <fcntl.h>
> -- 
> 2.33.1
>
Simon Glass Jan. 26, 2022, 3:36 p.m. UTC | #2
Hi,

it works and build pass without error or warning.
Tested on alpine edge aarch64 bare metal.

Thank you

On Fri, 2022-01-21 at 18:01, Heinrich Schuchardt wrote:
> The definition of struct udphdr in include netinet/udp.h in the
> musl library differs from the definition in the glibc library.
>
> To use the same definition with musl the symbol _GNU_SOURCE has
> to be defined.
>
> Reported-by: Milan P. Stanić <mps@arvanta.net>
> Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>

Tested-by: Milan P. Stanić <mps@arvanta.net>

> ---
>  arch/sandbox/cpu/eth-raw-os.c | 2 ++
>  1 file changed, 2 insertions(+)
>
Applied to u-boot-dm, thanks!
diff mbox series

Patch

diff --git a/arch/sandbox/cpu/eth-raw-os.c b/arch/sandbox/cpu/eth-raw-os.c
index 6a8d809756..e59b96be5f 100644
--- a/arch/sandbox/cpu/eth-raw-os.c
+++ b/arch/sandbox/cpu/eth-raw-os.c
@@ -4,6 +4,8 @@ 
  * Copyright (c) 2015-2018 Joe Hershberger <joe.hershberger@ni.com>
  */
 
+#define _GNU_SOURCE
+
 #include <asm/eth-raw-os.h>
 #include <errno.h>
 #include <fcntl.h>