Also include toolchain standard header as system header. These are
required by xdp-tools that try to include stddef.h and stdbool.h for
some tools. These header are usually in /lib/gcc/../include but musl
also have some special variant in /include.
To fix compilation of xdp-tools, also include these standard header.
These header should follow ISO C standard and should not introduce
regression in bpf tools making them specific to an arch.
Link: https://github.com/openwrt/openwrt/pull/15390
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
Commit d82c5884c6 ("treewide: make use of new toolchain define")
changed $(TOOLCHAIN_DIR)/include to the new variable
$(TOOLCHAIN_INC_DIRS) that now can contain multiple entry.
Because of this only the first include in $(TOOLCHAIN_INC_DIRS) was
actually included with -isystem, making the other producing warning with
ignored inputs.
Fix this by parsing each entry in $(TOOLCHAIN_INC_DIRS) and adding the
-isystem prefix to correctly include them in the BPF_KERNEL_INCLUDE.
Fixes: d82c5884c6 ("treewide: make use of new toolchain define")
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
Make use of new toolchain define. TOOLCHAIN_DIR should be used only for
toolchain related packages and for everything else TOOLCHAIN_ROOT_DIR
and other define should be used instead.
Switch to new entry where possible.
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
To download a package the LLVM bins are not strictly needed.
Currently with an example run of make package/bridger/download V=s, the
build fail with
make[2]: Entering directory '/home/ansuel/openwrt-ansuel/openwrt/package/network/services/bridger'
bash: line 1: /home/ansuel/openwrt-ansuel/openwrt/staging_dir/host/llvm-bpf/bin/clang: No such file or directory
bash: line 1: [: : integer expression expected
/home/ansuel/openwrt-ansuel/openwrt/include/bpf.mk:71: *** ERROR: LLVM/clang version too old. Minimum required: 12, found: . Stop.
make[2]: Leaving directory '/home/ansuel/openwrt-ansuel/openwrt/package/network/services/bridger'
time: package/network/services/bridger/download#0.04#0.00#0.06
ERROR: package/network/services/bridger failed to build.
This is wrong since it may be needed to download the required packages
first and then compile them later.
Fix this by ignoring the LLVM bin check on non compile steps.
Tested-by: Robert Marko <robimarko@gmail.com>
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
unetd always includes $(INCLUDE_DIR)/bpf.mk. This file always checks if
the LLVM version is supported in CLANG_VER_VALID. unetd only needs bpf
when UNETD_VXLAN_SUPPORT is set. It fails when UNETD_VXLAN_SUPPORT is
not set and llvm is not installed.
Fix it by only checking the LLVM version when a LLVM toolchain is
available.
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Ubuntu started to flag which as deprecated and it
seems which is not really standard and may vary
across Distro.
Drop the use of which and use the standard 'command -v'
for this simple task.
Which is still present in the prereq if some package/script
still use which.
A utility script called command_all.sh is implemented that
will just mimic the output of which -a.
Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
BTF pointer data has a different size on 32 vs 64 bit targets,
and while the generated eBPF code works, the BTF data fails to validate
on mismatch
Signed-off-by: Felix Fietkau <nbd@nbd.name>
When the prebuilt llvm toolchain is unpacked into the source dir,
it is automatically picked up and used by the build system, and eBPF
based packages can be selected
Signed-off-by: Felix Fietkau <nbd@nbd.name>
In order to genererate suitable kernel headers, a 5.10 kernel tree is
prepared with a default config for mips. The arch is forced to mips in
order to avoid issues with inline asm on various architectures in a way
that doesn't involve relying on the host toolchain/headers.
It also has the advantage of supporting both endian types
Signed-off-by: Felix Fietkau <nbd@nbd.name>