Re: [PATCH 4/4] perf symbol: Add missing libgen.h include to get basename() prototype

From: Ian Rogers

Date: Wed Apr 01 2026 - 17:08:56 EST


On Wed, Apr 1, 2026 at 2:02 PM Arnaldo Carvalho de Melo <acme@xxxxxxxxxx> wrote:
>
> From: Arnaldo Carvalho de Melo <acme@xxxxxxxxxx>
>
> This works in some places because there are tricks to prefer a GNU
> version instead of the XPG version, but started breaking in some musl
> libc systems due to some unrelated change that made libgen.h stop being
> included by chance.
>
> Since symbol.h is using basename(), make it include libgen.h.
>
> Signed-off-by: Arnaldo Carvalho de Melo <acme@xxxxxxxxxx>
> ---
> tools/perf/tests/make | 2 +-
> tools/perf/util/symbol.h | 1 +
> 2 files changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/tools/perf/tests/make b/tools/perf/tests/make
> index 6587dc326d1b272e..e12ff6397077806e 100644
> --- a/tools/perf/tests/make
> +++ b/tools/perf/tests/make
> @@ -148,7 +148,7 @@ run += make_extra_tests
> run += make_no_jevents
> run += make_jevents_all
> run += make_no_bpf_skel
> -run += make_gen_vmlinux_h
> +#run += make_gen_vmlinux_h

This looks like something removed during testing that you meant to put back.

Thanks,
Ian

> run += make_libperl
> run += make_no_libpython
> run += make_no_scripts
> diff --git a/tools/perf/util/symbol.h b/tools/perf/util/symbol.h
> index c67814d6d6d6f64a..b37ecc2e90f77efe 100644
> --- a/tools/perf/util/symbol.h
> +++ b/tools/perf/util/symbol.h
> @@ -10,6 +10,7 @@
> #include <linux/rbtree.h>
> #include <stdio.h>
> #include <errno.h>
> +#include <libgen.h>
> #include "addr_location.h"
> #include "path.h"
> #include "symbol_conf.h"
> --
> 2.53.0
>