build dir isn't properly specified as a dependency
A free file archiver for extremely high compression
Brought to you by:
ipavlov
When using parallel the mkdir needs to be complete before object files are attempted to be created. But the makefile doesn't specify the build dir to be a dependency of the objects so make may attempt to create object files before the build dir was created.
Short reproducer on linux using GNU Make:
$ cd CPP/7zip/Bundles/Alone2
$ make -f ../../cmpl_gcc.mak -j10 --shuffle=reverse
Proposed fix, add $(O) as a order-only dependency for all the $(OBJS) files:
--- CPP/7zip/7zip_gcc.mak
+++ CPP/7zip/7zip_gcc.mak
all: $(O) $(PROGPATH) $(STATIC_TARGET)
+$(OBJS): | $(O)
+
$(O):
$(MY_MKDIR) $(O)
Bug report about this on gentoo: https://bugs.gentoo.org/933619
Sorry, I meant to open this as a bug not patch.
Is it new switch:
--shuffle=reverse
?It doesn't work in my
make
.The
--shuffle
switch was added in GNU Make v4.4 in order to detect missing dependencies that causes parallel build failures: https://trofi.github.io/posts/238-new-make-shuffle-mode.htmlGNU Make v4.4 was released in 31 Oct 2022, so it's not too new. I suppose your make version is older than that.
I've also seen sporadic build errors with -j due to the target directory sometimes not getting created before the first ASMC output completes and tries and fails to write to the output location.
Since I was batching my builds together into a shell script I just pre-created the directories beforehand in my script before calling make.