Skip to content
This repository was archived by the owner on Sep 30, 2024. It is now read-only.

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

README.md

Libbpf

Reference

Examples

Usage

make target=hello
make clean target=hello

Other

Generate vmlinux.h

# Make sure you have installed bpftool already.
bpftool btf dump file /sys/kernel/btf/vmlinux format c > vmlinux.h

If you encounter the following error:

(Why wsl has too many problem... <( _ _ )>):

/usr/include/linux/types.h:5:10: fatal error: 'asm/types.h' file not found
#include <asm/types.h>
         ^~~~~~~~~~~~~
1 error generated.

Create a symbolic Link to asm ( you need to have asm-generic )

sudo ln -s /usr/include/asm-generic /usr/include/asm

Header files missing:

/usr/include/features-time64.h:20:10: fatal error: 'bits/wordsize.h' file not found
#include <bits/wordsize.h>
         ^~~~~~~~~~~~~~~~~
1 error generated.
/usr/include/features.h:486:12: fatal error: 'sys/cdefs.h' file not found
#  include <sys/cdefs.h>
           ^~~~~~~~~~~~~
1 error generated.
/usr/include/features.h:510:10: fatal error: 'gnu/stubs.h' file not found
#include <gnu/stubs.h>
         ^~~~~~~~~~~~~
1 error generated.

Add compile options:

-I/usr/include/x86_64-linux-gnu

32bit header file missing:

/usr/include/features.h:486:12: fatal error: 'sys/cdefs.h' file not found
#  include <sys/cdefs.h>
           ^~~~~~~~~~~~~
1 error generated.
sudo apt-get install libc6-dev-i386