dfskoll / rp-pppoe

Public repository for RP-PPPoE PPPoE client and server software
https://dianne.skoll.ca/projects/rp-pppoe/
47 stars 15 forks source link

src/pppoe.h: fix build with musl libc #4

Closed ffontaine closed 2 years ago

ffontaine commented 2 years ago

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:

Signed-off-by: Fabrice Fontaine fontaine.fabrice@gmail.com

dfskoll commented 2 years ago

Thank you; looks fine.