diff mbox series

[meta-oe] pcp: Fix parallel build race in vendored libvalkey

Message ID 20261201084556.2108816-1-khem.raj@oss.qualcomm.com
State New
Headers show
Series [meta-oe] pcp: Fix parallel build race in vendored libvalkey | expand

Commit Message

Khem Raj Dec. 1, 2026, 8:45 a.m. UTC
src/libvalkey symlinks the libvalkey sources into deps/ and orders the
objects after them with a pattern rule that has no recipe, which GNU
make ignores. With parallel make an object can be compiled before its
headers are linked:

  deps/libvalkey/src/adlist.c:30:10: fatal error: adlist.h: No such file or directory

Make $(OBJECTS) depend on the linked files instead. libpcp_web does the
same for the vendored inih, so fix it there too.

AI-Generated: Uses Claude Code
Signed-off-by: Khem Raj <khem.raj@oss.qualcomm.com>
---
 meta-oe/recipes-support/pcp/pcp.inc           |  1 +
 ...red-objects-depend-on-their-symlinke.patch | 53 +++++++++++++++++++
 2 files changed, 54 insertions(+)
 create mode 100644 meta-oe/recipes-support/pcp/pcp/0001-build-Make-vendored-objects-depend-on-their-symlinke.patch
diff mbox series

Patch

diff --git a/meta-oe/recipes-support/pcp/pcp.inc b/meta-oe/recipes-support/pcp/pcp.inc
index d25f717148..5efe58bc07 100644
--- a/meta-oe/recipes-support/pcp/pcp.inc
+++ b/meta-oe/recipes-support/pcp/pcp.inc
@@ -10,6 +10,7 @@  COMPATIBLE_HOST:libc-musl = "null"
 SRC_URI = "git://github.com/performancecopilot/pcp;branch=main;protocol=https;tag=${PV} \
            file://0001-configure-Limit-the-header-search-to-sysroot.patch \
            file://0001-htop-Change-dependency-order-of-header-and-sourcefil.patch \
+           file://0001-build-Make-vendored-objects-depend-on-their-symlinke.patch \
            file://config.linux \
 	   "
 
diff --git a/meta-oe/recipes-support/pcp/pcp/0001-build-Make-vendored-objects-depend-on-their-symlinke.patch b/meta-oe/recipes-support/pcp/pcp/0001-build-Make-vendored-objects-depend-on-their-symlinke.patch
new file mode 100644
index 0000000000..e12e4dd1c6
--- /dev/null
+++ b/meta-oe/recipes-support/pcp/pcp/0001-build-Make-vendored-objects-depend-on-their-symlinke.patch
@@ -0,0 +1,53 @@ 
+From 80c93b77f2abba2fd63f04ee8902754d00cdfe39 Mon Sep 17 00:00:00 2001
+From: Khem Raj <khem.raj@oss.qualcomm.com>
+Date: Mon, 30 Nov 2026 23:28:21 -0800
+Subject: [PATCH] build: Make vendored objects depend on their symlinked
+ sources
+
+libvalkey and libpcp_web symlink the vendored libvalkey and inih sources
+into deps/ and add the dependency with
+
+  %.o: $(LIBVALKEY_XFILES)
+
+A pattern rule without a recipe is ignored by GNU make, so the objects
+only depend on their .c file through the built-in rule. With parallel
+make an object can be compiled before the headers are linked:
+
+  deps/libvalkey/src/adlist.c:30:10: fatal error: adlist.h: No such file or directory
+  make[3]: *** [<builtin>: deps/libvalkey/src/adlist.o] Error 1
+
+Make $(OBJECTS) depend on the linked files instead.
+
+Upstream-Status: Pending
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ src/libpcp_web/src/GNUmakefile | 2 +-
+ src/libvalkey/src/GNUmakefile  | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/src/libpcp_web/src/GNUmakefile b/src/libpcp_web/src/GNUmakefile
+index 759c372..20b00d3 100644
+--- a/src/libpcp_web/src/GNUmakefile
++++ b/src/libpcp_web/src/GNUmakefile
+@@ -164,7 +164,7 @@ $(LIBTARGET): $(VERSION_SCRIPT) $(XFILES) $(INIH_XFILES) \
+ 		$(TOPDIR)/src/libvalkey/src/libvalkey.a
+ endif
+ 
+-%.o: $(INIH_XFILES)
++$(OBJECTS): $(INIH_XFILES)
+ 
+ jsmn.o:		jsmn.c jsmn.h
+ discover.o:	discover.h discover.c
+diff --git a/src/libvalkey/src/GNUmakefile b/src/libvalkey/src/GNUmakefile
+index c1608bb..03270c7 100644
+--- a/src/libvalkey/src/GNUmakefile
++++ b/src/libvalkey/src/GNUmakefile
+@@ -48,7 +48,7 @@ deps/libvalkey/include/valkey/adapters deps/libvalkey/include/valkey deps/libval
+ $(LIBVALKEY_XFILES): | deps/libvalkey/include/valkey/adapters deps/libvalkey/include/valkey deps/libvalkey/src
+ 	$(LN_S) -f $(realpath $(TOPDIR))/vendor/github.com/valkey-io/$(@:deps/%=%) $@
+ 
+-%.o: $(LIBVALKEY_XFILES)
++$(OBJECTS): $(LIBVALKEY_XFILES)
+ 
+ install: default
+ 	$(INSTALL) -m 755 $(STATICLIBTARGET) $(PCP_LIB_DIR)/$(STATICLIBTARGET)