From 8954637bbcbe28630fa084c6129d79275a663ce8 Mon Sep 17 00:00:00 2001 From: DrDoof Date: Wed, 28 Oct 2026 17:40:19 +0100 Subject: [PATCH] sdcc: fix the device library race in parallel builds The mcs51 library target writes into ../build/$(PORT) without depending on it, so with -j the archiver can start before the directory exists and the toolchain build fails with sdar: ../build/small/mcs51.lib: No such file or directory It is intermittent: the same tree builds fine on a retry. --- ...0004-mcs51-device-lib-parallel-mkdir.patch | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 sdcc/0004-mcs51-device-lib-parallel-mkdir.patch diff --git a/sdcc/0004-mcs51-device-lib-parallel-mkdir.patch b/sdcc/0004-mcs51-device-lib-parallel-mkdir.patch new file mode 100644 index 00000000..53c17c33 --- /dev/null +++ b/sdcc/0004-mcs51-device-lib-parallel-mkdir.patch @@ -0,0 +1,23 @@ +Parallel builds race: the library target writes into ../build/$(PORT) but does +not depend on it, so with -j the archiver can run before the directory exists: + + sdar: ../build/small/mcs51.lib: No such file or directory + +Give the target an order-only dependency on its output directory. + +Index: device/lib/mcs51/Makefile.in +=================================================================== +--- device/lib/mcs51/Makefile.in (revision 17011) ++++ device/lib/mcs51/Makefile.in (working copy) +@@ -30,7 +30,10 @@ + + all: $(PORTDIR)/$(LIB) + +-$(PORTDIR)/$(LIB): $(OBJ) Makefile ++$(PORTDIR): ++ mkdir -p $@ ++ ++$(PORTDIR)/$(LIB): $(OBJ) Makefile | $(PORTDIR) + ifeq ($(LIB_TYPE), SDCCLIB) + rm -f $@; \ + $(top_builddir)/bin/sdcclib -a $@ $(OBJ)