Skip to content

Compilation failure for bps.c #5338

@tdihp

Description

@tdihp

Hi, I'm using Ubuntu 22.04 for compling. Already installed dependencies following INSTALL.md.

[ 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions