Browse Source

package/rp-pppoe: fix musl build

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 <fontaine.fabrice@gmail.com>
Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
Fabrice Fontaine 3 years ago
parent
commit
474f35eb54
1 changed files with 60 additions and 0 deletions
  1. 60 0
      package/rp-pppoe/0002-src-pppoe.h-fix-build-with-musl-libc.patch

+ 60 - 0
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
+