Skip to content
EK3new edited this page Jul 30, 2024 · 3 revisions

Build errors and solutions

Here is a list of errors that might occur when executing cargo build -r --examples and the following solutions to the error.

Missing submodules

  • Missing submodule "bpftool" will cause error as shown below. Update the submodules("bpftool", "xdp-tools") with git submodule update --init --recursive, and try building again.
process didn't exit successfully: /.../packetvisor/target/release/build/packetvisor-fb2dd9624bd678a7/build-script-build (exit status: 101)
  --- stdout
  cargo:rerun-if-changed=build.rs
  cargo:rerun-if-changed=Cargo.lock
  Build bpftool on /.../packetvisor/target/release/build/packetvisor-dbb39ee45b721ffe/out/bpftool

  --- stderr
  make: *** src: No such file or directory.  Stop.
  thread 'main' panicked at build.rs:44:5:
  Failed to build bpftool
  • When the submodule "bpftool" is not updated recursively, error may occur as shown below. Update the submodule with git submodule update --init --recursive.
  --- stderr
  make[1]: *** /.../packetvisor/target/release/build/packetvisor-dbb39ee45b721ffe/out/bpftool/libbpf/src: No such file or directory.  Stop.
  make: *** [Makefile:44: /.../packetvisor/target/release/build/packetvisor-dbb39ee45b721ffe/out/bpftool/src/libbpf/libbpf.a] Error 2
  thread 'main' panicked at build.rs:44:5:
  Failed to build bpftool
  • Missing submodule "xdp-tools" will cause error as shown below. Update the submodule with git submodule update --init --recursive, and try building again.
make: Leaving directory '/.../packetvisor/target/release/build/packetvisor-dbb39ee45b721ffe/out/bpftool/src'
  --- stderr
  make: *** No rule to make target 'libxdp'.  Stop.
  thread 'main' panicked at build.rs:56:5:
  Failed to build libxdp
  • When the submodule "xdp-tools" is not updated recursively, error may occur as shown below. Update the submodule with git submodule update --init --recursive.
  --- stderr
  fatal: not a git repository: /.../packetvisor/target/release/build/packetvisor-dbb39ee45b721ffe/out/xdp-tools/../.git/modules/xdp-tools
  make[2]: *** libbpf/src: No such file or directory.  Stop.
  make[1]: *** [Makefile:50: libbpf/src/libbpf.a] Error 2
  make: *** [Makefile:28: libxdp] Error 2
  thread 'main' panicked at build.rs:56:5:
  Failed to build libxdp

Missing packages

  • Missing llvm, install with apt-get install llvm.
  --- stderr
  make: llvm-strip: No such file or directory
  make: *** [Makefile:209: pid_iter.bpf.o] Error 127
  thread 'main' panicked at build.rs:44:5:
  Failed to build bpftool
  • Missing libelf-dev, install with apt-get install libelf-dev.
  --- stderr
  Package libelf was not found in the pkg-config search path.
  Perhaps you should add the directory containing `libelf.pc'
  to the PKG_CONFIG_PATH environment variable
  No package 'libelf' found
  btf.c:18:10: fatal error: gelf.h: No such file or directory
     18 | #include <gelf.h>
        |          ^~~~~~~~
  compilation terminated.
  make[1]: *** [Makefile:131: /.../packetvisor/target/release/build/packetvisor-dbb39ee45b721ffe/out/bpftool/src/libbpf/staticobjs/btf.o] Error 1
  make: *** [Makefile:44: /.../packetvisor/target/release/build/packetvisor-dbb39ee45b721ffe/out/bpftool/src/libbpf/libbpf.a] Error 2
  thread 'main' panicked at build.rs:44:5:
  Failed to build bpftool
  • Missing gcc-multilib, install with apt-get install gcc-multilib.
  --- stderr
  In file included from xdp-dispatcher.c:3:
  In file included from ../../headers/linux/bpf.h:11:
  /usr/include/linux/types.h:5:10: fatal error: 'asm/types.h' file not found
  #include <asm/types.h>
           ^~~~~~~~~~~~~
  1 error generated.
  make[2]: *** [Makefile:137: xdp-dispatcher.o] Error 1
  make[1]: *** [Makefile:20: libxdp] Error 2
  make: *** [Makefile:28: libxdp] Error 2
  thread 'main' panicked at build.rs:56:5:
  Failed to build libxdp
  • Missing m4, install with apt-get install m4.
  *** ERROR: Cannot find tool m4

  --- stderr
  make: *** [Makefile:49: config.mk] Error 1
  thread 'main' panicked at build.rs:56:5:
  Failed to build libxdp
  • Missing make, install with apt-get install make.
  --- stdout
  cargo:rerun-if-changed=build.rs
  cargo:rerun-if-changed=Cargo.lock
  Build bpftool on /.../packetvisor/target/release/build/packetvisor-dbb39ee45b721ffe/out/bpftool

  --- stderr
  thread 'main' panicked at build.rs:42:10:
  Could not execute make for bpftool: Os { code: 2, kind: NotFound, message: "No such file or directory" }

Clone this wiki locally