From b88323e4e0d17dccae92e79875a2015a1e9f3c47 Mon Sep 17 00:00:00 2001 From: James Hilliard Date: Sat, 1 Oct 2022 00:09:53 +0000 Subject: [PATCH] meson: set minimum libbpf/bpftool versions for bpf-gcc We need the following libbpf commits for bpf-gcc compatibility: - https://github.com/libbpf/libbpf/commit/3d484ca47339b23afb2ec7c508ed9a3a5cf1d287 - https://github.com/libbpf/libbpf/commit/b31ca3fa0e62fde6aa66f855136e29e088ad9dde These are first present in libbpf 1.0.0 and bpftool 7.0.0. --- meson.build | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/meson.build b/meson.build index 4f193ce17b..e76cc1dc6b 100644 --- a/meson.build +++ b/meson.build @@ -1047,18 +1047,28 @@ if not libcap.found() endif want_bpf_framework = get_option('bpf-framework') +bpf_compiler = get_option('bpf-compiler') bpf_framework_required = want_bpf_framework == 'true' -libbpf = dependency('libbpf', required : bpf_framework_required, version : '>= 0.2') +libbpf_version_requirement = '>= 0.2.0' +if bpf_compiler == 'gcc' + libbpf_version_requirement = '>= 1.0.0' +endif +libbpf = dependency('libbpf', required : bpf_framework_required, version : libbpf_version_requirement) conf.set10('HAVE_LIBBPF', libbpf.found()) +bpftool_strip_version_requirement = '>= 5.13.0' +if bpf_compiler == 'gcc' + bpftool_strip_version_requirement = '>= 7.0.0' +endif + if want_bpf_framework == 'false' or not libbpf.found() or skip_deps conf.set10('BPF_FRAMEWORK', false) else - bpf_compiler = get_option('bpf-compiler') clang_found = false clang_supports_bpf = false bpf_gcc_found = false + bpftool_strip = false deps_found = false if bpf_compiler == 'clang' @@ -1094,16 +1104,16 @@ else # Debian installs this in /usr/sbin/ which is not in $PATH. # We check for 'bpftool' first, honouring $PATH, and in /usr/sbin/ for Debian. # We use 'bpftool gen object' subcommand for bpftool strip, it was added by d80b2fcbe0a023619e0fc73112f2a02c2662f6ab (v5.13). + bpftool_strip_required = bpf_framework_required and bpf_compiler == 'gcc' bpftool = find_program('bpftool', '/usr/sbin/bpftool', - required : false, - version : '>= 5.13.0') + required : bpftool_strip_required, + version : bpftool_strip_version_requirement) if bpftool.found() bpftool_strip = true deps_found = true - else - bpftool_strip = false + elif bpf_compiler == 'clang' # We require the 'bpftool gen skeleton' subcommand, it was added by 985ead416df39d6fe8e89580cc1db6aa273e0175 (v5.6). bpftool = find_program('bpftool', '/usr/sbin/bpftool',