pcp: fix build race condition

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>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
This commit is contained in:
Yoann Congal 2025-06-03 13:51:30 +02:00 committed by Khem Raj
parent e970ff8bff
commit 8aaf41d024
No known key found for this signature in database
GPG Key ID: BB053355919D3314
2 changed files with 34 additions and 0 deletions

View File

@ -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

View File

@ -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}"