iovisor / iovisor/bcc

fatal error: 'uapi/linux/bpf.h' file not found

Open
#2,325 1 comment 3 reactions 0 assignees View on GitHub
Dominant language
C
Stars
22.7k
Forks
4.1k
Avg merge
5d 13h
Merged PRs (30d)
3

Description

I am new to BPF and trying to run a simple hello_program as below.
```
#include
#define SEC(NAME) __attribute__((section(NAME), used))

SEC("tracepoint/syscalls/sys_enter_execve")
int bpf_prog(void *ctx) {
char msg[] = "Hello, BPF World!";
bpf_trace_printk(msg, sizeof(msg));
return 0;
}
char _license[] SEC("license") = "GPL";
```
Getting following error

```
clang -O2 -target bpf -c hello_world_kern.c -o hello_world_kern.o
hello_world_kern.c:1:10: fatal error: 'uapi/linux/bpf.h' file not found
#include
^~~~~~~~~~~~~~~~~~
1 error generated.
```
My linux version is
```
lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 18.04.1 LTS
Release: 18.04
Codename: bionic

uname -r
4.15.0-46-generic
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Begin with hello_world_kern.c and the clang command shown; investigate why the uapi/linux/bpf.h include cannot be resolved in the stated Ubuntu 18.04 and kernel environment. Done means the example compiles successfully and the required header setup is identified.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, linux
Domain
devtools, operating-systems
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
32/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.