error: field ‘in’ has incomplete type

Question

git clone --recurse-submodules https://github.com/libbpf/bpftool.git

export PATH=/usr/local/mips/mipsel-buildroot-linux-gnu/bin:$PATH
CC=mipsel-linux-gcc make

[...]

  CC       json_writer.o
  CC       link.o
In file included from link.c:6:
/usr/local/mips/mipsel-buildroot-linux-gnu/mipsel-buildroot-linux-gnu/sysroot/usr/include/linux/netfilter.h:67:17: error: field ‘in’ has incomplete type
   67 |  struct in_addr in;
      |                 ^~
/usr/local/mips/mipsel-buildroot-linux-gnu/mipsel-buildroot-linux-gnu/sysroot/usr/include/linux/netfilter.h:68:18: error: field ‘in6’ has incomplete type
   68 |  struct in6_addr in6;
      |                  ^~~
link.c:579:3: error: ‘NFPROTO_NETDEV’ undeclared here (not in a function); did you mean ‘NFPROTO_DECNET’?
  579 |  [NFPROTO_NETDEV] = "netdev",
      |   ^~~~~~~~~~~~~~
      |   NFPROTO_DECNET
link.c:579:3: error: array index in initializer not of integer type
link.c:579:3: note: (near initialization for ‘pf2name’)

Answer

kernel header in toolchain is a little bit old

Rebuild toolchain with below patch:

- BR2_KERNEL_HEADERS_VERSION=y
- BR2_DEFAULT_KERNEL_VERSION="3.10.90"
- BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_3_10=y
+ BR2_KERNEL_HEADERS_4_14=y
0%