vifino / nix-geht

vifino's random nixpkgs, available on NUR, later in nixpkgs?
MIT License
1 stars 0 forks source link

vpp: AF_XDP doesn't compile. #6

Closed vifino closed 1 year ago

vifino commented 2 years ago

It gives a af_xdp plugins - no working libbpf found - af_xdp plugin disabled warning because the compile check fails. I don't know why or what it is doing exactly, but I may try to troubleshoot that later.

For now, I haven't had a usecase for it and it seems very new.

vifino commented 2 years ago
-- Found Python3: /nix/store/vvcjl6cdspd1hf4jn8byp2k7801sa2xa-python3-3.10.7-env/bin/python3.10 (found version "3.10.7") found components: Interpreter
/build/source/src/plugins/af_xdp/CMakeLists.txt(14):  vpp_find_path(BPF_INCLUDE_DIR NAMES bpf/xsk.h )
/build/source/src/plugins/af_xdp/CMakeLists.txt(15):  if(NOT BPF_INCLUDE_DIR )
/build/source/src/plugins/af_xdp/CMakeLists.txt(20):  set_property(GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS TRUE )
/build/source/src/plugins/af_xdp/CMakeLists.txt(21):  vpp_plugin_find_library(af_xdp BPF_LIB libbpf.a )
-- af_xdp plugin needs libbpf.a library - found at /nix/store/c1qvkgpx594g4grsgn4yfvc7j40b87ry-libbpf-0.8.1/lib/libbpf.a
/build/source/src/plugins/af_xdp/CMakeLists.txt(22):  vpp_plugin_find_library(af_xdp BPF_ELF_LIB elf )
-- af_xdp plugin needs elf library - found at /nix/store/3n4f7bpw8vkb05vmchpbm061k3mfqg0g-libelf-0.8.13/lib/libelf.so
/build/source/src/plugins/af_xdp/CMakeLists.txt(23):  vpp_plugin_find_library(af_xdp BPF_Z_LIB z )
-- af_xdp plugin needs z library - found at /nix/store/91cri48yw4ca4bq46i1p5fa440nv0hyr-zlib-1.2.12/lib/libz.so
/build/source/src/plugins/af_xdp/CMakeLists.txt(24):  if(NOT BPF_LIB OR NOT BPF_ELF_LIB OR NOT BPF_Z_LIB )
/build/source/src/plugins/af_xdp/CMakeLists.txt(29):  set(CMAKE_REQUIRED_FLAGS -fPIC )
/build/source/src/plugins/af_xdp/CMakeLists.txt(30):  set(CMAKE_REQUIRED_INCLUDES /nix/store/c1qvkgpx594g4grsgn4yfvc7j40b87ry-libbpf-0.8.1/include )
/build/source/src/plugins/af_xdp/CMakeLists.txt(31):  set(CMAKE_REQUIRED_LIBRARIES /nix/store/c1qvkgpx594g4grsgn4yfvc7j40b87ry-libbpf-0.8.1/lib/libbpf.a /nix/store/3n4
f7bpw8vkb05vmchpbm061k3mfqg0g-libelf-0.8.13/lib/libelf.so /nix/store/91cri48yw4ca4bq46i1p5fa440nv0hyr-zlib-1.2.12/lib/libz.so )
/build/source/src/plugins/af_xdp/CMakeLists.txt(32):  CHECK_C_SOURCE_COMPILES(                                                                                         #include <bpf/xsk.h>
int main(void)
{
    return xsk_socket__create (0, 0, 0, 0, 0, 0, 0);
} BPF_COMPILES_CHECK )
-- Performing Test BPF_COMPILES_CHECK
-- Performing Test BPF_COMPILES_CHECK - Failed
/build/source/src/plugins/af_xdp/CMakeLists.txt(38):  if(NOT BPF_COMPILES_CHECK )
/build/source/src/plugins/af_xdp/CMakeLists.txt(39):  message(WARNING af_xdp plugins - no working libbpf found - af_xdp plugin disabled )
-- af_xdp plugins - no working libbpf found - af_xdp plugin disabled
/build/source/src/plugins/af_xdp/CMakeLists.txt(40):  return()

I tried to compile the CHECK_C_SOURCE_COMPILES source manually:

[nix-shell:/tmp/build-test]$ gcc -o test test.c -I /nix/store/c1qvkgpx594g4grsgn4yfvc7j40b87ry-libbpf-0.8.1/include /nix/store/c1qvkgpx594g4grsgn4yfvc7j40b87ry-libbpf-0.8.1/lib/libbpf.a /nix/store/3n4f7bpw8vkb05vmchpbm061k3mfqg0g-libelf-0.8.13/lib/libelf.so /nix/store/91cri48yw4ca4bq46i1p5fa440nv0hyr-zlib-1.2.12/lib/libz.so
test.c: In function ‘main’:
test.c:4:5: warning: ‘xsk_socket__create’ is deprecated: libbpf v0.7+: AF_XDP support deprecated and moved to libxdp [-Wdeprecated-declarations]
    4 |     return xsk_socket__create (0, 0, 0, 0, 0, 0, 0);
      |     ^~~~~~
In file included from test.c:1:
/nix/store/c1qvkgpx594g4grsgn4yfvc7j40b87ry-libbpf-0.8.1/include/bpf/xsk.h:310:5: note: declared here
  310 | int xsk_socket__create(struct xsk_socket **xsk,
      |     ^~~~~~~~~~~~~~~~~~
/nix/store/i38w7ashc8bvz4zh1i8gzbb3c5z3l71x-binutils-2.39/bin/ld: /nix/store/c1qvkgpx594g4grsgn4yfvc7j40b87ry-libbpf-0.8.1/lib/libbpf.a(usdt.o): in function `usdt_manager_attach_usdt':
(.text+0xb7b): undefined reference to `gelf_getnote'
collect2: error: ld returned 1 exit status

The deprecation warning makes me itchy, but the problem is that libelf isn't elfutils, and vpp needs elfutils' libelf.

vifino commented 2 years ago

Satz mit X war wohl nix. It really doesn't like the deprecated functions. Guess I gotta package libxdp? Ugh.