由于要编译bpf环境,打开内核编译选项CONFIG_DEBUG_INFO_BTF,安装pahole,用于生成.tmp_vmlinux.btf,本文是centos环境
[root@localhost linux-5.4.69]# make -j 4
DESCEND objtool
CALL scripts/atomic/check-atomics.sh
CALL scripts/checksyscalls.sh
CHK include/generated/compile.h
GEN .version
CHK include/generated/compile.h
UPD include/generated/compile.h
CC init/version.o
AR init/built-in.a
LD vmlinux.o
MODPOST vmlinux.o
MODINFO modules.builtin.modinfo
BTF: .tmp_vmlinux.btf: pahole version v1.9 is too old, need at least v1.13
Failed to generate BTF for vmlinux
Try to disable CONFIG_DEBUG_INFO_BTF
make[1]: *** [vmlinux] Error 1
make: *** [sub-make] Error 2
对于Centos系统,下载dwarves的src.rpm来自己编译,比如可以从阿里云上搜索dwarves软件包:阿里巴巴开源镜像站-阿里云官网开发者社区_云计算社区
执行下面的命令编译二进制rpm安装包:
rpmbuild --rebuild dwarves-1.21-1.fc33.src.rpm
如果缺少依赖包,会有提示,安装完依赖包。
如果最后包下面的错误,说明没有安装完全,跳过这个错误执行后面命令。
CMake Warning:
Manually-specified variables were not used by the project:
CMAKE_CXX_FLAGS_RELEASE
CMAKE_Fortran_FLAGS_RELEASE
INCLUDE_INSTALL_DIR
LIB_SUFFIX
SHARE_INSTALL_PREFIX
SYSCONF_INSTALL_DIR
-- Build files have been written to: /root/rpmbuild/BUILD/dwarves-1.21
+ %cmake_build
/var/tmp/rpm-tmp.a8akI5: line 47: fg: no job control
error: Bad exit status from /var/tmp/rpm-tmp.a8akI5 (%build)
RPM build errors:
dwarves-1.21-1.fc33.src.rpm: Header V4 RSA/SHA256 Signature, key ID 9570ff31: NOKEY
Bad exit status from /var/tmp/
执行下面命令“
cd /root/rpmbuild/BUILD/dwarves-1.21
make;make install
这是时候就安装成功了
执行下面命令
pahole --version