From e535eb9be8b3c57a2a1da5fb0377dec243b853c6 Mon Sep 17 00:00:00 2001 From: Michel Alexandre Salim Date: Jun 29 2023 16:18:10 +0000 Subject: Disable bpftool build by default. Works in mock but not in CBS Signed-off-by: Michel Alexandre Salim --- diff --git a/kernel-tools.spec b/kernel-tools.spec index 92aad3d..93e3a52 100644 --- a/kernel-tools.spec +++ b/kernel-tools.spec @@ -1,3 +1,9 @@ +# compiling bpftool succeeds on mock but fails in CBS for both hs.el8 and hs.el9 +# skeleton/pid_iter.bpf.c:47:14: error: incomplete definition of type 'struct bpf_perf_link' +# +# note: on hs.el9 it might be possible to use LIBBPF_DYNAMIC=1 so try when reenabling bpftool +%bcond_with bpftool + # Much of this is borrowed from the original kernel.spec # It needs a bunch of the macros for rawhide vs. not-rawhide builds. @@ -74,7 +80,9 @@ BuildRequires: audit-libs-devel glibc-devel glibc-headers glibc-static python3-d BuildRequires: asciidoc xmlto libcap-devel python3-setuptools BuildRequires: openssl-devel libbabeltrace-devel BuildRequires: libtracefs-devel libtraceevent-devel +%if %{with bpftool} BuildRequires: libbpf-devel +%endif BuildRequires: clang llvm # Used to mangle unversioned shebangs to be Python 3 BuildRequires: /usr/bin/pathfix.py @@ -174,12 +182,14 @@ Provides: kernel-tools-devel This package contains the development files for the tools/ directory from the kernel source. +%if %{with bpftool} %package -n bpftool Summary: Inspection and simple manipulation of eBPF programs and maps License: GPLv2 %description -n bpftool This package contains the bpftool, which allows inspection and simple manipulation of eBPF programs and maps. +%endif %package -n libperf Summary: The perf library from kernel source @@ -314,18 +324,22 @@ pushd tools/tracing/rtla %{tools_make} popd +%if %{with bpftool} %global bpftool_make \ make EXTRA_CFLAGS="${RPM_OPT_FLAGS}" EXTRA_LDFLAGS="%{__global_ldflags}" DESTDIR=$RPM_BUILD_ROOT V=1 pushd tools/bpf/bpftool %{bpftool_make} popd +%endif pushd tools/lib/perf make V=1 popd +%if %{with bpftool} # BPF samples %{make} %{?_smp_mflags} ARCH=$Arch V=1 M=samples/bpf/ VMLINUX_H="${RPM_VMLINUX_H}" || true +%endif # Build the docs pushd tools/kvm/kvm_stat/ @@ -432,13 +446,16 @@ popd pushd tools/kvm/kvm_stat %{tools_make} INSTALL_ROOT=%{buildroot} install-tools popd +%if %{with bpftool} pushd tools/bpf/bpftool %{bpftool_make} prefix=%{_prefix} bash_compdir=%{_sysconfdir}/bash_completion.d/ mandir=%{_mandir} install doc-install popd +%endif pushd tools/lib/perf make DESTDIR=%{buildroot} prefix=%{_prefix} libdir=%{_libdir} V=1 install install_headers popd +%if %{with bpftool} # install bpf samples pushd samples/bpf install -d %{buildroot}%{_libexecdir}/ksamples/bpf @@ -450,6 +467,7 @@ rm %{buildroot}%{_libexecdir}/ksamples/bpf/test_lwt_bpf.sh install -m644 *_kern.o %{buildroot}%{_libexecdir}/ksamples/bpf || true install -m644 tcp_bpf.readme %{buildroot}%{_libexecdir}/ksamples/bpf popd +%endif ### @@ -526,6 +544,7 @@ popd %{_includedir}/cpuidle.h %{_includedir}/powercap.h +%if %{with bpftool} %files -n bpftool %{_sbindir}/bpftool %{_sysconfdir}/bash_completion.d/bpftool @@ -543,6 +562,7 @@ popd %{_mandir}/man8/bpftool.8.gz %{_libexecdir}/ksamples %license linux-%{kversion}/COPYING +%endif %files -n libperf %{_libdir}/libperf.so.0