diff mbox series

[meta-oe] pcp: fix build race condition

Message ID 20250603115130.1530093-1-yoann.congal@smile.fr
State Under Review
Headers show
Series [meta-oe] pcp: fix build race condition | expand

Commit Message

Yoann Congal June 3, 2025, 11:51 a.m. UTC
From: Yoann Congal <yoann.congal@smile.fr>

In upstream (handcrafted) Makefile, .c and .h files are soft-linked
before being compiled. Under heavy load or a build with a high CPU
count, the compilation can start before header files are softlinked,
resulting in a build error:
| pcp-htop.c:13:10: fatal error: CommandLine.h: No such file or directory
|    13 | #include "CommandLine.h"
|       |          ^~~~~~~~~~~~~~~

Fix this by adding the make dependency between object files and the
headers.

Signed-off-by: Yoann Congal <yoann.congal@smile.fr>
---
 ...htop-fix-header-build-race-condition.patch | 33 +++++++++++++++++++
 meta-oe/recipes-support/pcp/pcp_6.3.7.bb      |  1 +
 2 files changed, 34 insertions(+)
 create mode 100644 meta-oe/recipes-support/pcp/pcp/0001-pcp-htop-fix-header-build-race-condition.patch
diff mbox series

Patch

diff --git a/meta-oe/recipes-support/pcp/pcp/0001-pcp-htop-fix-header-build-race-condition.patch b/meta-oe/recipes-support/pcp/pcp/0001-pcp-htop-fix-header-build-race-condition.patch
new file mode 100644
index 0000000000..48880fbb4d
--- /dev/null
+++ b/meta-oe/recipes-support/pcp/pcp/0001-pcp-htop-fix-header-build-race-condition.patch
@@ -0,0 +1,33 @@ 
+From d04ea418c5fcfec2f6fbb2dd9f982ddf12c5be87 Mon Sep 17 00:00:00 2001
+From: Yoann Congal <yoann.congal@smile.fr>
+Date: Tue, 3 Jun 2025 10:02:58 +0200
+Subject: [PATCH] pcp-htop: fix header build race condition
+
+.c and .h files are soft-linked before being compiled. Under heavy load
+or a build with a high CPU count, the compilation can start before
+header files are softlinked, resulting in a build error:
+| pcp-htop.c:13:10: fatal error: CommandLine.h: No such file or directory
+|    13 | #include "CommandLine.h"
+|       |          ^~~~~~~~~~~~~~~
+
+Fix this by adding the make dependency between object files and the
+headers.
+
+Upstream-Status: Submitted [https://github.com/performancecopilot/pcp/pull/2217]
+Signed-off-by: Yoann Congal <yoann.congal@smile.fr>
+---
+ src/pcp/htop/GNUmakefile | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/src/pcp/htop/GNUmakefile b/src/pcp/htop/GNUmakefile
+index 3e29638d6..898f0b766 100644
+--- a/src/pcp/htop/GNUmakefile
++++ b/src/pcp/htop/GNUmakefile
+@@ -224,6 +224,7 @@ default:	build-me
+ include $(BUILDRULES)
+ 
+ ifeq "$(HAVE_NCURSESW)" "true"
++$(OBJECTS): $(HFILES)
+ build-me: $(TOPXFILES) $(SUBXFILES) $(CFGXFILES) $(CMDTARGET) $(DISTLINKS) $(MAN_PAGES)
+ 
+ install: default
diff --git a/meta-oe/recipes-support/pcp/pcp_6.3.7.bb b/meta-oe/recipes-support/pcp/pcp_6.3.7.bb
index c390b9eec2..65efac06be 100644
--- a/meta-oe/recipes-support/pcp/pcp_6.3.7.bb
+++ b/meta-oe/recipes-support/pcp/pcp_6.3.7.bb
@@ -14,6 +14,7 @@  SRC_URI += "file://0001-Remove-unsuitble-part-for-cross-compile.patch \
             file://pass-options-to-AR.patch \
             file://fix_parallel_make.patch \
 			file://0001-bind2-Use-pmcpp-from-native-builds.patch \
+            file://0001-pcp-htop-fix-header-build-race-condition.patch \
            "
 
 export PCP_DIR = "${RECIPE_SYSROOT_NATIVE}"