Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tcplife-bpfcc failed on ubuntu22.04 lts #4758

Open
yuezhongtao opened this issue Oct 11, 2023 · 1 comment
Open

tcplife-bpfcc failed on ubuntu22.04 lts #4758

yuezhongtao opened this issue Oct 11, 2023 · 1 comment

Comments

@yuezhongtao
Copy link

yuezhongtao commented Oct 11, 2023

env info:

root@charles:/usr/share/bpfcc-tools# apt list bpfcc-tools
Listing... Done
bpfcc-tools/jammy,now 0.18.0+ds-2 all [installed]
root@charles:/usr/share/bpfcc-tools# 
root@charles:/usr/share/bpfcc-tools# uname -a
Linux charles 5.15.0-73-generic #80-Ubuntu SMP Mon May 15 15:18:50 UTC 2023 aarch64 aarch64 aarch64 GNU/Linux
root@charles:/usr/share/bpfcc-tools# 
root@charles:/usr/share/bpfcc-tools# 
root@charles:/usr/share/bpfcc-tools# cat /etc/*release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=22.04
DISTRIB_CODENAME=jammy
DISTRIB_DESCRIPTION="Ubuntu 22.04.2 LTS"
PRETTY_NAME="Ubuntu 22.04.2 LTS"
NAME="Ubuntu"
VERSION_ID="22.04"
VERSION="22.04.2 LTS (Jammy Jellyfish)"
VERSION_CODENAME=jammy
ID=ubuntu
ID_LIKE=debian
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
UBUNTU_CODENAME=jammy

command output:

root@charles:/usr/share/bpfcc-tools# tcplife-bpfcc 
In file included from /virtual/main.c:3:
In file included from include/linux/tcp.h:19:
In file included from include/net/sock.h:46:
In file included from include/linux/netdevice.h:41:
In file included from include/net/netprio_cgroup.h:11:
In file included from include/linux/cgroup.h:28:
In file included from include/linux/cgroup-defs.h:22:
In file included from include/linux/bpf-cgroup.h:5:
include/linux/bpf.h:211:35: error: invalid application of 'sizeof' to an incomplete type 'struct bpf_timer'
                memset(dst + map->timer_off, 0, sizeof(struct bpf_timer));
                                                ^     ~~~~~~~~~~~~~~~~~~
include/linux/bpf.h:211:49: note: forward declaration of 'struct bpf_timer'
                memset(dst + map->timer_off, 0, sizeof(struct bpf_timer));
                                                              ^
include/linux/bpf.h:225:10: error: invalid application of 'sizeof' to an incomplete type 'struct bpf_timer'
                t_sz = sizeof(struct bpf_timer);
                       ^     ~~~~~~~~~~~~~~~~~~
include/linux/bpf.h:225:24: note: forward declaration of 'struct bpf_timer'
                t_sz = sizeof(struct bpf_timer);
                                     ^
include/linux/bpf.h:539:26: error: use of undeclared identifier 'BPF_PSEUDO_FUNC'
               insn->src_reg == BPF_PSEUDO_FUNC;
                                ^
In file included from /virtual/main.c:3:
In file included from include/linux/tcp.h:19:
In file included from include/net/sock.h:59:
include/linux/filter.h:1518:44: error: use of undeclared identifier 'BPF_F_BROADCAST'; did you mean 'IFF_BROADCAST'?
        if (unlikely(!ri->tgt_value) && !(flags & BPF_F_BROADCAST)) {
                                                  ^~~~~~~~~~~~~~~
                                                  IFF_BROADCAST
include/uapi/linux/if.h:86:2: note: 'IFF_BROADCAST' declared here
        IFF_BROADCAST                   = 1<<1,  /* volatile */
        ^
In file included from /virtual/main.c:3:
In file included from include/linux/tcp.h:19:
In file included from include/net/sock.h:59:
include/linux/filter.h:1533:14: error: use of undeclared identifier 'BPF_F_BROADCAST'; did you mean 'IFF_BROADCAST'?
        if (flags & BPF_F_BROADCAST) {
                    ^~~~~~~~~~~~~~~
                    IFF_BROADCAST
include/uapi/linux/if.h:86:2: note: 'IFF_BROADCAST' declared here
        IFF_BROADCAST                   = 1<<1,  /* volatile */
        ^
5 errors generated.
Traceback (most recent call last):
  File "/usr/sbin/tcplife-bpfcc", line 455, in <module>
    b = BPF(text=bpf_text)
  File "/usr/lib/python3/dist-packages/bcc/__init__.py", line 364, in __init__
    raise Exception("Failed to compile BPF module %s" % (src_file or "<text>"))
Exception: Failed to compile BPF module <text>
@iyht
Copy link

iyht commented May 14, 2024

I encountered the same issue after installing by sudo apt-get install bpfcc-tools linux-headers-$(uname -r). I resolved it by following instructions to compile and install bcc, and now sudo /usr/share/bcc/tools/tcplife is working.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants