From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
To: Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>,
linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org
Subject: Re: [BUG] perf tools: Build failure in v6.16-rc1
Date: Wed, 11 Jun 2025 17:06:15 +0200 [thread overview]
Message-ID: <20250611150615.FcVIIhgA@linutronix.de> (raw)
In-Reply-To: <aEmY259Mx92D60KG@x1>
On 2025-06-11 11:55:23 [-0300], Arnaldo Carvalho de Melo wrote:
> commit 8386dc356158fc50c55831c96b1248e01d112ebc
> Author: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
> Date: Wed Jun 11 11:25:42 2025 +0200
>
> perf bench futex: Fix prctl include in musl libc
>
> Namhyung Kim reported:
>
> I've updated the perf-tools-next to v6.16-rc1 and found a build error
> like below on alpine linux 3.18.
>
> In file included from bench/futex.c:6:
> /usr/include/sys/prctl.h:88:8: error: redefinition of 'struct prctl_mm_map'
> 88 | struct prctl_mm_map {
> | ^~~~~~~~~~~~
> In file included from bench/futex.c:5:
> /linux/tools/include/uapi/linux/prctl.h:134:8: note: originally defined here
> 134 | struct prctl_mm_map {
> | ^~~~~~~~~~~~
> make[4]: *** [/linux/tools/build/Makefile.build:86: /build/bench/futex.o] Error 1
>
> git bisect says it's the first commit introduced the failure.
>
> So your /usr/include/sys/prctl.h and
> /linux/tools/include/uapi/linux/prctl.h both provide struct prctl_mm_map
> but their include guard must be different.
>
> My /usr/include/sys/prctl.h is provided by glibc and contains the
> prctl() declaration. It includes also linux/prctl.h. The
> tools/include/uapi/linux/prctl.h is the same as
> /usr/include/linux/prctl.h.
>
> The /usr/include/sys/prctl.h on alpine linux is different. This is
> probably coming from musl. It contains the PR_* definition and the
> prctl() declaration. So it clashes here because now the one struct is
> available twice.
>
> The man page for prctl(2) says:
>
> | #include <linux/prctl.h> /* Definition of PR_* constants */
> | #include <sys/prctl.h>
>
> so musl doesn't follow this.
>
> So align with the other builds.
>
> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
> Reported-by: Namhyung Kim <namhyung@kernel.org>
> Link: https://lore.kernel.org/r/20250611092542.F4ooE2FL@linutronix.de
s/Link/Closes/
> [ Remove one more in tools/perf/bench/futex-hash.c and conditionally define PR_FUTEX_HASH and friends ]
> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
>
> diff --git a/tools/perf/bench/futex-hash.c b/tools/perf/bench/futex-hash.c
> index fdf133c9520f73a4..d2d6d7f3ea331c84 100644
> --- a/tools/perf/bench/futex-hash.c
> +++ b/tools/perf/bench/futex-hash.c
> @@ -18,7 +18,6 @@
> #include <stdlib.h>
> #include <linux/compiler.h>
> #include <linux/kernel.h>
> -#include <linux/prctl.h>
> #include <linux/zalloc.h>
> #include <sys/time.h>
> #include <sys/mman.h>
> diff --git a/tools/perf/bench/futex.c b/tools/perf/bench/futex.c
> index 26382e4d8d4ce2ff..4c4fee107e5912d5 100644
> --- a/tools/perf/bench/futex.c
> +++ b/tools/perf/bench/futex.c
> @@ -2,11 +2,18 @@
> #include <err.h>
> #include <stdio.h>
> #include <stdlib.h>
> -#include <linux/prctl.h>
> #include <sys/prctl.h>
>
This is what I had locally and was waiting for confirmation.
> #include "futex.h"
>
> +#ifndef PR_FUTEX_HASH
> +#define PR_FUTEX_HASH 78
> +# define PR_FUTEX_HASH_SET_SLOTS 1
> +# define FH_FLAG_IMMUTABLE (1ULL << 0)
> +# define PR_FUTEX_HASH_GET_SLOTS 2
> +# define PR_FUTEX_HASH_GET_IMMUTABLE 3
> +#endif // PR_FUTEX_HASH
Is this needed? Aren't these defines coming from that local copy?
> void futex_set_nbuckets_param(struct bench_futex_parameters *params)
> {
> unsigned long flags;
Sebastian
next prev parent reply other threads:[~2025-06-11 15:06 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-10 18:34 [BUG] perf tools: Build failure in v6.16-rc1 Namhyung Kim
2025-06-11 9:25 ` Sebastian Andrzej Siewior
2025-06-11 13:14 ` Arnaldo Carvalho de Melo
2025-06-11 14:55 ` Arnaldo Carvalho de Melo
2025-06-11 15:06 ` Sebastian Andrzej Siewior [this message]
2025-06-11 19:01 ` Arnaldo Carvalho de Melo
2025-06-11 21:50 ` Namhyung Kim
2025-06-12 6:25 ` Sebastian Andrzej Siewior
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250611150615.FcVIIhgA@linutronix.de \
--to=bigeasy@linutronix.de \
--cc=acme@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=namhyung@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).