diff mbox series

[wrynose,meta-oe,15/45] musl-nscd: Fix parallel build race on generated sources

Message ID 20261201064402.3934788-15-anuj.mittal@oss.qualcomm.com
State Under Review
Delegated to: Anuj Mittal
Headers show
Series [wrynose,meta-networking,01/45] proftpd: upgrade 1.3.9d -> 1.3.9e | expand

Commit Message

Anuj Mittal Dec. 1, 2026, 6:43 a.m. UTC
From: Khem Raj <khem.raj@oss.qualcomm.com>

lex/yacc output in obj/src has no order-only dependency on the object
directories, so with parallel make lex can run before obj/src exists:

  /bin/sh: 1: cannot create obj/src/nsswitch.yy.c: Directory nonexistent

AI-Generated: Uses Claude Code
Signed-off-by: Khem Raj <khem.raj@oss.qualcomm.com>
(cherry picked from commit 96229556573ed03aa864cd44e01bf3bd6a9ebc2d)
Signed-off-by: Anuj Mittal <anuj.mittal@oss.qualcomm.com>
---
 ...object-directories-before-generating.patch | 34 +++++++++++++++++++
 .../recipes-devtools/musl/musl-nscd_git.bb    |  1 +
 2 files changed, 35 insertions(+)
 create mode 100644 meta-oe/recipes-devtools/musl/musl-nscd/0001-Makefile-Create-object-directories-before-generating.patch
diff mbox series

Patch

diff --git a/meta-oe/recipes-devtools/musl/musl-nscd/0001-Makefile-Create-object-directories-before-generating.patch b/meta-oe/recipes-devtools/musl/musl-nscd/0001-Makefile-Create-object-directories-before-generating.patch
new file mode 100644
index 0000000000..57f121f917
--- /dev/null
+++ b/meta-oe/recipes-devtools/musl/musl-nscd/0001-Makefile-Create-object-directories-before-generating.patch
@@ -0,0 +1,34 @@ 
+From 140313750a1e5e36aefa50b0c6b8e63336435ef8 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Thu, 19 Nov 2026 22:36:18 -0800
+Subject: [PATCH] Makefile: Create object directories before generating sources
+
+obj/src/nsswitch.yy.c and obj/src/nsswitch.tab.c are written by lex and
+yacc into obj/src, but only the objects, binaries, tests and generated
+headers have an order-only dependency on the object directories. A
+parallel build can therefore run lex before obj/src exists:
+
+  /bin/sh: 1: cannot create obj/src/nsswitch.yy.c: Directory nonexistent
+
+Add the generated sources to the order-only dependency on $(OBJ_DIRS).
+
+Upstream-Status: Submitted [https://github.com/pikhq/musl-nscd/pull/43]
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ Makefile | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/Makefile b/Makefile
+index 1c69255..9de221e 100644
+--- a/Makefile
++++ b/Makefile
+@@ -40,7 +40,7 @@ all: $(TOOLS)
+ 
+ OBJ_DIRS = $(sort $(patsubst %/,%,$(dir $(BINS) $(OBJS) $(TESTS) $(GENH))) obj/src obj/include)
+ 
+-$(TESTS) $(BINS) $(OBJS) $(GENH): | $(OBJ_DIRS)
++$(TESTS) $(BINS) $(OBJS) $(GENH) $(GEN_SRCS): | $(OBJ_DIRS)
+ 
+ $(OBJ_DIRS):
+ 	mkdir -p $@
diff --git a/meta-oe/recipes-devtools/musl/musl-nscd_git.bb b/meta-oe/recipes-devtools/musl/musl-nscd_git.bb
index ef2553760d..94a404bb7e 100644
--- a/meta-oe/recipes-devtools/musl/musl-nscd_git.bb
+++ b/meta-oe/recipes-devtools/musl/musl-nscd_git.bb
@@ -14,6 +14,7 @@  PV = "1.1.0"
 SRCREV = "cddd6be6c629ca96f2d2e74ee52daf12bbef1f83"
 SRC_URI = "git://github.com/pikhq/musl-nscd;branch=master;protocol=https \
            file://0001-nsswitch.y-Replace-empty-bison-extension.patch \
+           file://0001-Makefile-Create-object-directories-before-generating.patch \
           "
 
 UPSTREAM_CHECK_COMMITS = "1"