[PATCH v1 07/11] perf ui annotate-data: missing explicit inclusion of stdlib.h and stdio.h
From: Ian Rogers
Date: Thu Sep 17 2026 - 00:56:23 EST
Sashiko reported:
When compiling the Linux kernel performance tools (perf) on a system
using musl libc, a build failure occurs in
tools/perf/ui/browsers/annotate-data.c due to missing standard
header inclusions.
The source file directly invokes standard POSIX library functions
such as calloc(), free(), and snprintf() without explicitly
including <stdlib.h> and <stdio.h>. While glibc implicitly pulls in
these declarations via other included headers, musl libc strictly
separates standard header declarations and does not implicitly
expose them. This namespace isolation causes the compiler to
generate implicit-function-declaration errors when encountering
these undeclared identifiers, permanently failing the build.
Add the header files and use git clang-format to sort.
Reported-by: sashiko-bot@xxxxxxxxxx
Signed-off-by: Ian Rogers <irogers@xxxxxxxxxx>
---
tools/perf/ui/browsers/annotate-data.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/tools/perf/ui/browsers/annotate-data.c b/tools/perf/ui/browsers/annotate-data.c
index c6e07a9b6408..5ec02bfe30e4 100644
--- a/tools/perf/ui/browsers/annotate-data.c
+++ b/tools/perf/ui/browsers/annotate-data.c
@@ -1,6 +1,9 @@
// SPDX-License-Identifier: GPL-2.0
#include <inttypes.h>
+#include <stdio.h>
+#include <stdlib.h>
#include <string.h>
+
#include <linux/zalloc.h>
#include <sys/ttydefaults.h>
@@ -10,8 +13,8 @@
#include "ui/ui.h"
#include "util/annotate.h"
#include "util/annotate-data.h"
-#include "util/evsel.h"
#include "util/evlist.h"
+#include "util/evsel.h"
#include "util/sort.h"
#define FOLDED_SIGN '+'
--
2.55.0.1082.g2b9226bbc0-goog