iovisor / iovisor/bcc

Compilation failure for bps.c

Open
#5,338 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
C
Stars
22.7k
Forks
4.1k
Avg merge
10d 4h
Merged PRs (30d)
3

Description

Hi, I'm using Ubuntu 22.04 for compling. Already installed dependencies following [INSTALL.md](https://github.com/iovisor/bcc/blob/master/INSTALL.md).

``` text
[ 70%] Building C object introspection/CMakeFiles/bps.dir/bps.c.o
/home/ubuntu/code/bcc/introspection/bps.c:51:4: error: ‘BPF_PROG_TYPE_NETFILTER’ undeclared here (not in a function); did you mean ‘BPF_PROG_TYPE_SOCKET_FILTER’?
51 | [BPF_PROG_TYPE_NETFILTER] = "netfilter",
| ^~~~~~~~~~~~~~~~~~~~~~~
| BPF_PROG_TYPE_SOCKET_FILTER
/home/ubuntu/code/bcc/introspection/bps.c:51:4: error: array index in initializer not of integer type
/home/ubuntu/code/bcc/introspection/bps.c:51:4: note: (near initialization for ‘prog_type_strings’)
/home/ubuntu/code/bcc/introspection/bps.c:87:4: error: ‘BPF_MAP_TYPE_ARENA’ undeclared here (not in a function); did you mean ‘BPF_MAP_TYPE_ARRAY’?
87 | [BPF_MAP_TYPE_ARENA] = "arena",
| ^~~~~~~~~~~~~~~~~~
| BPF_MAP_TYPE_ARRAY
/home/ubuntu/code/bcc/introspection/bps.c:87:4: error: array index in initializer not of integer type
/home/ubuntu/code/bcc/introspection/bps.c:87:4: note: (near initialization for ‘map_type_strings’)
```

With further looking with strace, the files got read for headers that suppose to include `BPF_PROG_TYPE_NETFILTER` and `BPF_MAP_TYPE_ARRAY` is `src/cc/libbpf.h` and in turn `src/cc/libbpf/include/uapi/linux/bpf.h`, it looks like the kernel uapi header itself but not as updated to include the enum value bpc.c requires.

Unclear on if this is a build system issue (so it points to the wrong header) or the header should be updated, so leaving this as a question here. Thanks.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with introspection/bps.c and inspect the header resolution through src/cc/libbpf.h to src/cc/libbpf/include/uapi/linux/bpf.h. Compare the missing BPF_PROG_TYPE_NETFILTER and BPF_MAP_TYPE_ARENA definitions with the Ubuntu 22.04 build inputs and INSTALL.md guidance. Done means bps.c compiles successfully with the intended headers.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, linux
Domain
build-system, operating-systems
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.