环境

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# uname -a
Linux ningan 5.4.0-147-generic #164~18.04.1-Ubuntu SMP Tue Apr 4 00:20:20 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux

# cat /etc/os-release
NAME="Ubuntu"
VERSION="18.04.6 LTS (Bionic Beaver)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 18.04.6 LTS"
VERSION_ID="18.04"
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"
VERSION_CODENAME=bionic
UBUNTU_CODENAME=bionic

问题

1
2
3
4
5
6
7
8
# clang -O2 -g -target bpf -c bpf_sockops.c -o bpf_sockops.o
In file included from bpf_sockops.c:1:
In file included from /usr/include/linux/bpf.h:11:
/usr/include/linux/types.h:5:10: fatal error: 'asm/types.h' file not found
#include <asm/types.h>
^~~~~~~~~~~~~
1 error generated.

解决办法

1
# apt-get install -y gcc-multilib

参卡

# Debian下libbpf编译失败提示<asm/types.h>文件不存在解决方法


http://example.com/2023/05/04/ebpf/unsupported/【ebpf】编译/
作者
ningan123
发布于
2023年5月4日
许可协议