Bug 5847 - [ANCK-5.10-16][Anolis8][x86_64]升级bpftrace到0.16.0-1版本后,使用bpftrace src包做bpftrace-test测试时编译失败
Summary: [ANCK-5.10-16][Anolis8][x86_64]升级bpftrace到0.16.0-1版本后,使用bpftrace src包做bpftrac...
Status: NEW
Alias: None
Product: Antest
Classification: Infrastructures
Component: 测试用例 (show other bugs) 测试用例
Version: unspecified
Hardware: x86_64 Linux
: P3-Medium S3-normal
Target Milestone: ---
Assignee: gaochang
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-07-12 15:08 UTC by shanxifanshi
Modified: 2023-10-24 16:00 UTC (History)
11 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description shanxifanshi alibaba_cloud_group 2023-07-12 15:08:15 UTC
[缺陷描述]:
Anolis8 5.10 x86_64 使用最新最新的0.16.0-1 bpftrace src包做bpftrace-test测试时编译失败,失败原因是缺少libcereal-devel包

# rpm -q llvm
llvm-13.0.1-1.0.3.module+an8.7.0+10996+1588f068.x86_64

部分编译报错日志如下:
# cmake . -DCMAKE_BUILD_TYPE=RelWithDebInfo  -DBUILD_TESTING:BOOL=ON  -DBUILD_SHARED_LIBS:BOOL=ON -DOFFLINE_BUILDS:BOOL=ON
-- The C compiler identification is GNU 8.5.0
-- The CXX compiler identification is GNU 8.5.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found LibBcc: /usr/lib64/libbcc.so
-- Performing Test LIBBCC_ATTACH_KPROBE_SIX_ARGS_SIGNATURE
-- Performing Test LIBBCC_ATTACH_KPROBE_SIX_ARGS_SIGNATURE - Success
-- Performing Test LIBBCC_ATTACH_UPROBE_SEVEN_ARGS_SIGNATURE
-- Performing Test LIBBCC_ATTACH_UPROBE_SEVEN_ARGS_SIGNATURE - Success
-- Looking for bcc_usdt_foreach
-- Looking for bcc_usdt_foreach - not found
-- Found LibBpf: /usr/lib64/libbpf.so
-- Looking for btf_dump__new
-- Looking for btf_dump__new - not found
-- Looking for btf_dump__emit_type_decl
-- Looking for btf_dump__emit_type_decl - not found
-- Looking for bpf_prog_load
-- Looking for bpf_prog_load - not found
-- Looking for bpf_map_create
-- Looking for bpf_map_create - not found
-- Looking for bpf_map_lookup_batch
-- Looking for bpf_map_lookup_batch - found
-- Looking for bpf_link_create
-- Looking for bpf_link_create - found
-- Looking for bpf_prog_test_run_opts
-- Looking for bpf_prog_test_run_opts - found
-- Performing Test HAVE_LIBBPF_BTF_TYPE_CNT
-- Performing Test HAVE_LIBBPF_BTF_TYPE_CNT - Failed
-- Performing Test HAVE_LIBBPF_BTF_DUMP_NEW_V0_6_0
-- Performing Test HAVE_LIBBPF_BTF_DUMP_NEW_V0_6_0 - Failed
-- Performing Test HAVE_LIBBPF_BTF_DUMP_NEW_DEPRECATED
-- Performing Test HAVE_LIBBPF_BTF_DUMP_NEW_DEPRECATED - Failed
-- Performing Test HAVE_LIBBPF_KPROBE_MULTI
-- Performing Test HAVE_LIBBPF_KPROBE_MULTI - Failed
-- Found LibElf: /usr/lib64/libelf.so
CMake Error at /usr/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
  Please install the libcereal development package (missing:
  LIBCEREAL_INCLUDE_DIRS)
Call Stack (most recent call first):
  /usr/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:594 (_FPHSA_FAILURE_MESSAGE)
  cmake/FindLibCereal.cmake:14 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
  CMakeLists.txt:109 (find_package)


-- Configuring incomplete, errors occurred!
See also "/root/rpmbuild/BUILD/bpftrace-0.16.0/CMakeFiles/CMakeOutput.log".
See also "/root/rpmbuild/BUILD/bpftrace-0.16.0/CMakeFiles/CMakeError.log".

# yum repoinfo
Last metadata expiration check: 3:12:40 ago on Wed 12 Jul 2023 11:25:51 AM CST.
Repo-id            : AppStream
Repo-name          : AnolisOS-8 - AppStream
Repo-revision      : 1689130519
Repo-updated       : Wed 12 Jul 2023 10:55:21 AM CST
Repo-pkgs          : 8,600
Repo-available-pkgs: 7,189
Repo-size          : 19 G
Repo-baseurl       : http://mirrors.openanolis.cn/anolis/8/AppStream/x86_64/os
Repo-expire        : 172,800 second(s) (last: Wed 12 Jul 2023 11:25:37 AM CST)
Repo-filename      : /etc/yum.repos.d/AnolisOS-AppStream.repo

Repo-id            : BaseOS
Repo-name          : AnolisOS-8 - BaseOS
Repo-revision      : 1689130387
Repo-updated       : Wed 12 Jul 2023 10:53:07 AM CST
Repo-pkgs          : 2,196
Repo-available-pkgs: 2,194
Repo-size          : 3.7 G
Repo-baseurl       : http://mirrors.openanolis.cn/anolis/8/BaseOS/x86_64/os
Repo-expire        : 172,800 second(s) (last: Wed 12 Jul 2023 11:25:40 AM CST)
Repo-filename      : /etc/yum.repos.d/AnolisOS-BaseOS.repo

Repo-id            : Extras
Repo-name          : AnolisOS-8 - Extras
Repo-revision      : 1676272204
Repo-updated       : Mon 13 Feb 2023 03:10:04 PM CST
Repo-pkgs          : 7
Repo-available-pkgs: 7
Repo-size          : 81 k
Repo-baseurl       : http://mirrors.openanolis.cn/anolis/8/Extras/x86_64/os
Repo-expire        : 172,800 second(s) (last: Wed 12 Jul 2023 11:25:42 AM CST)
Repo-filename      : /etc/yum.repos.d/AnolisOS-Extras.repo

Repo-id            : Plus
Repo-name          : AnolisOS-8 - Plus
Repo-revision      : 1685324178
Repo-updated       : Mon 29 May 2023 09:36:18 AM CST
Repo-pkgs          : 222
Repo-available-pkgs: 222
Repo-size          : 3.7 G
Repo-baseurl       : http://mirrors.openanolis.cn/anolis/8/Plus/x86_64/os
Repo-expire        : 172,800 second(s) (last: Wed 12 Jul 2023 11:25:42 AM CST)
Repo-filename      : /etc/yum.repos.d/AnolisOS-Plus.repo

Repo-id            : PowerTools
Repo-name          : AnolisOS-8 - PowerTools
Repo-revision      : 1689056091
Repo-updated       : Tue 11 Jul 2023 02:14:52 PM CST
Repo-pkgs          : 1,697
Repo-available-pkgs: 1,142
Repo-size          : 5.5 G
Repo-baseurl       : http://mirrors.openanolis.cn/anolis/8/PowerTools/x86_64/os
Repo-expire        : 172,800 second(s) (last: Wed 12 Jul 2023 11:25:42 AM CST)
Repo-filename      : /etc/yum.repos.d/AnolisOS-PowerTools.repo

Repo-id            : epel
Repo-name          : Extra Packages for Enterprise Linux 8 - x86_64
Repo-revision      : 1689125629
Repo-updated       : Wed 12 Jul 2023 09:37:16 AM CST
Repo-pkgs          : 9,769
Repo-available-pkgs: 9,767
Repo-size          : 17 G
Repo-baseurl       : http://mirrors.aliyun.com/epel/8/Everything/x86_64
Repo-expire        : 172,800 second(s) (last: Wed 12 Jul 2023 11:25:51 AM CST)
Repo-filename      : /etc/yum.repos.d/epel.repo
Total packages: 22,491

[复现概率]:
必现

[复现环境]:
内核:
# uname -r
5.10.134-41.git.35b7f7f92.an8.x86_64

# cat /etc/os-release
NAME="Anolis OS"
VERSION="8.8"
ID="anolis"
ID_LIKE="rhel fedora centos"
VERSION_ID="8.8"
PLATFORM_ID="platform:an8"
PRETTY_NAME="Anolis OS 8.8"
ANSI_COLOR="0;31"
HOME_URL="https://openanolis.cn/"

CPU信息:
# lscpu
Architecture:        x86_64
CPU op-mode(s):      32-bit, 64-bit
Byte Order:          Little Endian
CPU(s):              24
On-line CPU(s) list: 0-23
Thread(s) per core:  2
Core(s) per socket:  12
Socket(s):           1
NUMA node(s):        1
Vendor ID:           GenuineIntel
BIOS Vendor ID:      Intel
CPU family:          6
Model:               63
Model name:          Intel(R) Xeon(R) CPU E5-2680 v3 @ 2.50GHz
BIOS Model name:     Intel(R) Xeon(R) CPU E5-2680 v3 @ 2.50GHz
Stepping:            2
CPU MHz:             2494.991
CPU max MHz:         2500.0000
CPU min MHz:         1200.0000
BogoMIPS:            4988.45
Virtualization:      VT-x
L1d cache:           32K
L1i cache:           32K
L2 cache:            256K
L3 cache:            30720K
NUMA node0 CPU(s):   0-23
Flags:               fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm cpuid_fault epb invpcid_single pti intel_ppin ssbd ibrs ibpb stibp tpr_shadow vnmi flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid cqm xsaveopt cqm_llc cqm_occup_llc dtherm arat pln pts md_clear flush_l1d

内存信息:
# free -h
              total        used        free      shared  buff/cache   available
Mem:           62Gi       1.8Gi        60Gi       118Mi       963Mi        60Gi
Swap:         2.0Gi       121Mi       1.9Gi

[复现步骤]:
1. 下载跟bpftrace版本匹配的源码包
yum install bpftrace
mkdir -p /root/bpftrace
cd /root/bpftrace
wget https://mirrors.openanolis.cn/anolis/8/AppStream/source/Packages/bpftrace-0.16.0-1.an8.src.rpm

2.解压源码并打上必要的补丁
rpm2cpio bpftrace-0.16.0-1.an8.src.rpm |cpio -div
yum -y install rpm-build yum-utils cmake llvm patch
mkdir -p  /root/rpmbuild/{BUILD,RPMS,SOURCES,SPECS,SRPMS}
echo "%_topdir  /root/rpmbuild" >~/.rpmmacros
cp -r /root/bpftrace/* /root/rpmbuild/SOURCES
cp -r /root/bpftrace/*.spec /root/rpmbuild/SPECS
yum-builddep -y /root/rpmbuild/SPECS/bpftrace.spec
rpmbuild -bp /root/rpmbuild/SPECS/bpftrace.spec

3.编译
cd /root/rpmbuild/BUILD/
wget -q http://242510.oss-cn-hangzhou-zmf.aliyuncs.com/googletest.tar.gz
bpftrace_src=`find . -name bpftrace-\[0-9\].* -type d`
tar xf googletest.tar.gz -C $bpftrace_src
cd $bpftrace_src
cmake . -DCMAKE_BUILD_TYPE=RelWithDebInfo  -DBUILD_TESTING:BOOL=ON  -DBUILD_SHARED_LIBS:BOOL=ON -DOFFLINE_BUILDS:BOOL=ON
sed -i "s|https://github.com/google|$(readlink -f .)|" tests/gtest-git-prefix/tmp/gtest-git-gitclone.cmake
make -j8


[预期结果]:
bpftrace源码编译成功

[实际结果]:
bpftrace源码编译失败
Comment 1 shanxifanshi alibaba_cloud_group 2023-07-12 15:10:34 UTC
这个是7月1号bpftrace包更新后出现的问题,由原来的0.12.1-4.0.1版本升级到了0.16.0-1版本,就会发生编译失败的问题。

对比了两个版本bpftrace src包安装之后的目录,结合报错情况,应该是新的bpftrace src包安装后多了一个cereal包,而这个包编译需要libcereal-devel文件,但我们的repo源中又没有该文件,导致编译失败,麻烦开发同学看下能否提供该包
Comment 2 shanxifanshi alibaba_cloud_group 2023-07-12 15:12:44 UTC
# yum install libcereal-devel
Last metadata expiration check: 3:46:10 ago on Wed 12 Jul 2023 11:25:51 AM CST.
No match for argument: libcereal-devel
Error: Unable to find a match: libcereal-devel

# yum search libcereal-devel --showduplicates
Last metadata expiration check: 3:46:24 ago on Wed 12 Jul 2023 11:25:51 AM CST.
No matches found.
Comment 3 gaochang alibaba_cloud_group 2023-07-13 10:10:05 UTC
说的是 cereal-devel 包吗?该包在 EPEL 源中是可用的,可以开启 EPEL 源尝试吗?
Comment 4 shanxifanshi alibaba_cloud_group 2023-07-13 10:11:33 UTC
(In reply to gaochang from comment #3)
> 说的是 cereal-devel 包吗?该包在 EPEL 源中是可用的,可以开启 EPEL 源尝试吗?

bug单描述里有贴epel源信息,是用的这个epel源,也没有cereal-devel包
Comment 5 shanxifanshi alibaba_cloud_group 2023-07-13 10:12:33 UTC
(In reply to shanxifanshi from comment #4)
> (In reply to gaochang from comment #3)
> > 说的是 cereal-devel 包吗?该包在 EPEL 源中是可用的,可以开启 EPEL 源尝试吗?
> 
> bug单描述里有贴epel源信息,是用的这个epel源,也没有cereal-devel包

http://mirrors.aliyun.com/epel/8/Everything/x86_64
Comment 6 shanxifanshi alibaba_cloud_group 2023-07-13 10:14:15 UTC
(In reply to gaochang from comment #3)
> 说的是 cereal-devel 包吗?该包在 EPEL 源中是可用的,可以开启 EPEL 源尝试吗?

我试下,安装这个包,看能编译成功不
Comment 7 shanxifanshi alibaba_cloud_group 2023-07-13 10:49:44 UTC
依次安装cereal-devel、gtest-devel、gmock-devel包之后,cmake可以成功编译,但是接下来进行make的时候,还有报错信息,麻烦帮忙再看下

# make
Consolidate compiler generated dependencies of target parser
[  3%] Built target parser
Consolidate compiler generated dependencies of target resources
[  3%] Building CXX object resources/CMakeFiles/resources.dir/headers.cpp.o
[  4%] Linking CXX shared library libresources.so
[  4%] Built target resources
Consolidate compiler generated dependencies of target runtime
[ 19%] Built target runtime
Consolidate compiler generated dependencies of target aot
[ 20%] Built target aot
Consolidate compiler generated dependencies of target arch
[ 21%] Built target arch
Consolidate compiler generated dependencies of target bpforc
[ 22%] Built target bpforc
Consolidate compiler generated dependencies of target ast_defs
[ 23%] Built target ast_defs
Consolidate compiler generated dependencies of target ast
[ 30%] Built target ast
Consolidate compiler generated dependencies of target cxxdemangler_llvm
[ 31%] Built target cxxdemangler_llvm
Consolidate compiler generated dependencies of target libbpftrace
[ 31%] Linking CXX shared library libbpftrace.so
[ 34%] Built target libbpftrace
Consolidate compiler generated dependencies of target bpftrace
[ 35%] Linking CXX executable bpftrace
libruntime.so: undefined reference to `bpftrace::BTF::get_btf_id(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const'
collect2: error: ld returned 1 exit status
make[2]: *** [src/CMakeFiles/bpftrace.dir/build.make:114: src/bpftrace] Error 1
make[1]: *** [CMakeFiles/Makefile2:1342: src/CMakeFiles/bpftrace.dir/all] Error 2
make: *** [Makefile:146: all] Error 2

上游存在相似问题,请参考
https://bugs.gentoo.org/873031
Comment 8 wangpingping alibaba_cloud_group 2023-08-28 18:25:26 UTC
alinux3 2023.8.26将bpftrace包从bpftrace-0.12.1-4.0.2.al8.x86_64升级到bpftrace-0.16.0-1.0.1.al8.x86_64版本后,编译出现了同样问题;