• Quentin Monnet's avatar
    bpftool: Install libbpf headers for the bootstrap version, too · e41ac202
    Quentin Monnet authored
    We recently changed bpftool's Makefile to make it install libbpf's
    headers locally instead of pulling them from the source directory of the
    library. Although bpftool needs two versions of libbpf, a "regular" one
    and a "bootstrap" version, we would only install headers for the regular
    libbpf build. Given that this build always occurs before the bootstrap
    build when building bpftool, this is enough to ensure that the bootstrap
    bpftool will have access to the headers exported through the regular
    libbpf build.
    
    However, this did not account for the case when we only want the
    bootstrap version of bpftool, through the "bootstrap" target. For
    example, perf needs the bootstrap version only, to generate BPF
    skeletons. In that case, when are the headers installed? For some time,
    the issue has been masked, because we had a step (the installation of
    headers internal to libbpf) which would depend on the regular build of
    libbpf and hence trigger the export of the headers, just for the sake of
    creating a directory. But this changed with commit 8b6c4624
    ("bpftool: Remove Makefile dep. on $(LIBBPF) for
    $(LIBBPF_INTERNAL_HDRS)"), where we cleaned up that stage and removed
    the dependency on the regular libbpf build. As a result, when we only
    want the bootstrap bpftool version, the regular libbpf is no longer
    built. The bootstrap libbpf version is built, but headers are not
    exported, and the bootstrap bpftool build fails because of the missing
    headers.
    
    To fix this, we also install the library headers for the bootstrap
    version of libbpf, to use them for the bootstrap bpftool and for
    generating the skeletons.
    
    Fixes: f012ade1 ("bpftool: Install libbpf headers instead of including the dir")
    Reported-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
    Signed-off-by: default avatarQuentin Monnet <quentin@isovalent.com>
    Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
    Tested-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
    Link: https://lore.kernel.org/bpf/20211105015813.6171-1-quentin@isovalent.com
    e41ac202
Makefile 7.99 KB