public inbox for openembedded-core@lists.openembedded.org
 help / color / mirror / Atom feed
* [PATCH] perf: Fix headers related build race condition
@ 2025-10-08  0:27 Khem Raj
  2025-10-13 11:36 ` [OE-core] " Richard Purdie
  0 siblings, 1 reply; 2+ messages in thread
From: Khem Raj @ 2025-10-08  0:27 UTC (permalink / raw)
  To: openembedded-core; +Cc: Khem Raj

libperf specifies paths to includes in its output
directory if they exist, however install_headers target
is run in parallel to source files being built for libperf
and can race with objects being built for libperf.

This patch ensures that all headers are built/installed before
they are used.

Specifying additional include paths via EXTRA_CFLAGS is of
no consequence anymore after [1] because it now is appended to
CFLAGS, so if we are trying to do include path oderining via
EXTRA_CFLAGS it will have no effect if those paths already are
in compiler commandline

[1] https://github.com/torvalds/linux/commit/f5b07010c13c77541e8ade167d05bef3b8a63739

Signed-off-by: Khem Raj <raj.khem@gmail.com>

s
---
 meta/recipes-kernel/perf/perf.bb | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/meta/recipes-kernel/perf/perf.bb b/meta/recipes-kernel/perf/perf.bb
index 3b9e52fdb84..f071685a4be 100644
--- a/meta/recipes-kernel/perf/perf.bb
+++ b/meta/recipes-kernel/perf/perf.bb
@@ -105,7 +105,7 @@ EXTRA_OEMAKE = '\
     LDSHARED="${CC} -shared" \
     AR="${AR}" \
     LD="${LD}" \
-    EXTRA_CFLAGS="-ldw -I${S} -I${S}/libperf/include -I${S}/tools/lib/perf/include" \
+    EXTRA_CFLAGS="-ldw -I${S}" \
     YFLAGS='-y --file-prefix-map=${WORKDIR}=${TARGET_DBGSRC_DIR}' \
     EXTRA_LDFLAGS="${PERF_EXTRA_LDFLAGS}" \
     perfexecdir=${libexecdir} \
@@ -173,8 +173,8 @@ do_compile() {
             sed -i -e 's|\$(libdir)/traceevent/plugins|\$(libdir)/traceevent_${KERNEL_VERSION}/plugins|g' ${S}/tools/perf/Makefile.config
 	# There are two copies of internal headers such as:
 	# libperf/include/internal/xyarray.h and tools/lib/perf/include/internal/xyarray.h
-	# For reproducibile binaries, we need to find one copy, hence force libperf to be created first
-	oe_runmake ${B}/libperf/libperf.a V=1
+	# For reproducibile binaries, we need to find one copy, so built the headers target first
+	oe_runmake -C ${S}/tools/lib/perf DESTDIR=${B}/libperf prefix= install_headers V=1
 	oe_runmake all V=1
 }
 


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [OE-core] [PATCH] perf: Fix headers related build race condition
  2025-10-08  0:27 [PATCH] perf: Fix headers related build race condition Khem Raj
@ 2025-10-13 11:36 ` Richard Purdie
  0 siblings, 0 replies; 2+ messages in thread
From: Richard Purdie @ 2025-10-13 11:36 UTC (permalink / raw)
  To: raj.khem, openembedded-core

On Tue, 2025-10-07 at 17:27 -0700, Khem Raj via lists.openembedded.org wrote:
> libperf specifies paths to includes in its output
> directory if they exist, however install_headers target
> is run in parallel to source files being built for libperf
> and can race with objects being built for libperf.
> 
> This patch ensures that all headers are built/installed before
> they are used.
> 
> Specifying additional include paths via EXTRA_CFLAGS is of
> no consequence anymore after [1] because it now is appended to
> CFLAGS, so if we are trying to do include path oderining via
> EXTRA_CFLAGS it will have no effect if those paths already are
> in compiler commandline
> 
> [1] https://github.com/torvalds/linux/commit/f5b07010c13c77541e8ade167d05bef3b8a63739
> 
> Signed-off-by: Khem Raj <raj.khem@gmail.com>
> 
> s
> ---
>  meta/recipes-kernel/perf/perf.bb | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/meta/recipes-kernel/perf/perf.bb b/meta/recipes-kernel/perf/perf.bb
> index 3b9e52fdb84..f071685a4be 100644
> --- a/meta/recipes-kernel/perf/perf.bb
> +++ b/meta/recipes-kernel/perf/perf.bb
> @@ -105,7 +105,7 @@ EXTRA_OEMAKE = '\
>      LDSHARED="${CC} -shared" \
>      AR="${AR}" \
>      LD="${LD}" \
> -    EXTRA_CFLAGS="-ldw -I${S} -I${S}/libperf/include -I${S}/tools/lib/perf/include" \
> +    EXTRA_CFLAGS="-ldw -I${S}" \
>      YFLAGS='-y --file-prefix-map=${WORKDIR}=${TARGET_DBGSRC_DIR}' \
>      EXTRA_LDFLAGS="${PERF_EXTRA_LDFLAGS}" \
>      perfexecdir=${libexecdir} \
> @@ -173,8 +173,8 @@ do_compile() {
>              sed -i -e 's|\$(libdir)/traceevent/plugins|\$(libdir)/traceevent_${KERNEL_VERSION}/plugins|g' ${S}/tools/perf/Makefile.config
>  	# There are two copies of internal headers such as:
>  	# libperf/include/internal/xyarray.h and tools/lib/perf/include/internal/xyarray.h
> -	# For reproducibile binaries, we need to find one copy, hence force libperf to be created first
> -	oe_runmake ${B}/libperf/libperf.a V=1
> +	# For reproducibile binaries, we need to find one copy, so built the headers target first
> +	oe_runmake -C ${S}/tools/lib/perf DESTDIR=${B}/libperf prefix= install_headers V=1
>  	oe_runmake all V=1
>  }

This basically does the same thing as the other make command. Looking
at the failure logs, I think the issue is in other libraries so I've
taken this idea but applied it to the other libraries too. I'm hoping
that fixes this.

Cheers,

Richard


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-10-13 11:36 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-08  0:27 [PATCH] perf: Fix headers related build race condition Khem Raj
2025-10-13 11:36 ` [OE-core] " Richard Purdie

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox