[Buildroot] [git commit] package/rp-pppoe: fix musl build

From: Arnout Vandecappelle (Essensium/Mind) <hidden>
Date: 2021-12-12 14:54:39
Subsystem: the rest · Maintainer: Linus Torvalds

commit: https://git.buildroot.net/buildroot/commit/?id=474f35eb544b6ffe64fb5f2c1e086fcd2f1a431b
branch: https://git.buildroot.net/buildroot/commit/?id=refs/heads/master

Fix the following musl build failure raised since bump of pppd to
version 2.4.9 in commit 075b01f2f7b5a9241b4bfe76db8f14af0284060c:

In file included from pppoe.h:133,
                 from debug.c:19:
/home/giuliobenetti/autobuild/run/instance-0/output-1/host/riscv64-buildroot-linux-musl/sysroot/usr/include/netinet/if_ether.h:116:8: error: redefinition of 'struct ethhdr'
  116 | struct ethhdr {
      |        ^~~~~~
In file included from pppoe.h:121,
                 from debug.c:19:
/home/giuliobenetti/autobuild/run/instance-0/output-1/host/riscv64-buildroot-linux-musl/sysroot/usr/include/linux/if_ether.h:163:8: note: originally defined here
  163 | struct ethhdr {
      |        ^~~~~~

Fixes:
 - http://autobuild.buildroot.org/results/ccca18fcbcde65cb6784f5559eac68ca17ab14a3

Signed-off-by: Fabrice Fontaine <redacted>
Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <redacted>
---
 ...0002-src-pppoe.h-fix-build-with-musl-libc.patch | 60 ++++++++++++++++++++++
 1 file changed, 60 insertions(+)
diff --git a/package/rp-pppoe/0002-src-pppoe.h-fix-build-with-musl-libc.patch b/package/rp-pppoe/0002-src-pppoe.h-fix-build-with-musl-libc.patch
new file mode 100644
index 0000000000..29ba72be4f
--- /dev/null
+++ b/package/rp-pppoe/0002-src-pppoe.h-fix-build-with-musl-libc.patch
@@ -0,0 +1,60 @@
+From bbf5b2759cff0c65b47fd6dbe5fe7341f205ad03 Mon Sep 17 00:00:00 2001
+From: Fabrice Fontaine <fontaine.fabrice@gmail.com>
+Date: Sat, 11 Dec 2021 22:03:16 +0100
+Subject: [PATCH] src/pppoe.h: fix build with musl libc
+
+musl libc defines its own struct ethhdr that conflicts with the kernel
+define one. The kernel headers provide a way to suppress its struct
+ethhdr. For that to work the libc headers must precede the kernel. Move
+the kernel linux/if_ether.h include below libc netinet/if_ether.h. That
+fixes the following build failure:
+
+In file included from pppoe.h:133,
+                 from debug.c:19:
+/home/giuliobenetti/autobuild/run/instance-0/output-1/host/riscv64-buildroot-linux-musl/sysroot/usr/include/netinet/if_ether.h:116:8: error: redefinition of 'struct ethhdr'
+  116 | struct ethhdr {
+      |        ^~~~~~
+In file included from pppoe.h:121,
+                 from debug.c:19:
+/home/giuliobenetti/autobuild/run/instance-0/output-1/host/riscv64-buildroot-linux-musl/sysroot/usr/include/linux/if_ether.h:163:8: note: originally defined here
+  163 | struct ethhdr {
+      |        ^~~~~~
+
+Fixes:
+ - http://autobuild.buildroot.org/results/ccca18fcbcde65cb6784f5559eac68ca17ab14a3
+
+Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
+[Upstream status: https://github.com/dfskoll/rp-pppoe/pull/4]
+---
+ src/pppoe.h | 8 ++++----
+ 1 file changed, 4 insertions(+), 4 deletions(-)
+
+diff --git a/src/pppoe.h b/src/pppoe.h
+index 4780092..2b08111 100644
+--- a/src/pppoe.h
++++ b/src/pppoe.h
+@@ -117,10 +117,6 @@ typedef unsigned long UINT32_t;
+ #error Could not find a 32-bit integer type
+ #endif
+ 
+-#ifdef HAVE_LINUX_IF_ETHER_H
+-#include <linux/if_ether.h>
+-#endif
+-
+ #include <netinet/in.h>
+ 
+ #ifdef HAVE_NETINET_IF_ETHER_H
+@@ -134,6 +130,10 @@ typedef unsigned long UINT32_t;
+ #endif
+ #endif
+ 
++#ifdef HAVE_LINUX_IF_ETHER_H
++#include <linux/if_ether.h>
++#endif
++
+ 
+ 
+ /* Ethernet frame types according to RFC 2516 */
+-- 
+2.33.0
+
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help