manuel-serrano / bigloo

a practical Scheme compiler
http://www-sop.inria.fr/indes/fp/Bigloo
Other
138 stars 19 forks source link

parallel bigloo builds fail #118

Open NHOrus opened 4 months ago

NHOrus commented 4 months ago

Successfully simulated failing builds with, say, MAKEOPTS="-j1 --shuffle=1852839864"

clang -I -I. -I/var/tmp/portage/dev-scheme/bigloo-4.5b/work/bigloo-4.5b/lib/bigloo/4.5b -fPIC -I/usr/include/gc -fPIC -I. -I /var/tmp/portage/dev-scheme/bigloo-4.5b/work/bigloo-4.5b/lib/bigloo/4.5b table.c -o objs/table.o -c
error: unable to open output file 'objs/table.o': 'No such file or directory'

Will provide patch when I'm sure I squished most of them.

NHOrus commented 4 months ago
diff -ru a/bdb/Makefile b/bdb/Makefile
--- a/bdb/Makefile      2024-06-05 17:06:40.098823516 -0000
+++ b/bdb/Makefile      2024-06-05 17:06:45.520796235 -0000
@@ -23,9 +23,14 @@
 #*---------------------------------------------------------------------*/
 #*    Booting bdb on a bare system                                     */
 #*---------------------------------------------------------------------*/
-boot:
-       @ (cd blib; $(MAKE) all)
-       @ (cd bdb; $(MAKE) MODE=final mode)
+boot: blip-boot bdb-boot
+
+blip-boot:
+       @ $(MAKE) -C bdb MODE=final mode
+
+bdb-boot: blip-boot
+       @ $(MAKE) -C blib all
+

 #*---------------------------------------------------------------------*/
 #*    Populating bdb                                                   */
diff -ru a/bdb/blib/Makefile b/bdb/blib/Makefile
--- a/bdb/blib/Makefile 2024-06-05 17:06:40.100823506 -0000
+++ b/bdb/blib/Makefile 2024-06-05 17:07:40.738518401 -0000
@@ -80,9 +80,11 @@
 #*    The implicit rules                                               */
 #*---------------------------------------------------------------------*/
 objs/%.o: %.scm
+       mkdir -p $(CLASS_DIR)
        $(BIGLOO) -no-hello $(BDBFLAGS) -copt $(CPICFLAGS) $< -o $@ -c

 objs/%.o: %.c
+       mkdir -p $(CLASS_DIR)
        $(CC) $(CFLAGS) $(CPICFLAGS) -I. -I $(LIB) $< -o $@ -c

 $(CLASS_DIR)/%.class: %.scm
@@ -145,7 +147,7 @@
 #*--- lib-jvm ---------------------------------------------------------*/
 lib-jvm: $(TAGS) $(CLASS_DIR) lib.zip

-$(CLASS_DIR): 
+$(CLASS_DIR):
        mkdir -p $(CLASS_DIR)

 lib.zip: .afile .jfile $(BGL_CLASSES) $(JAVA_CLASSES_SRC) dojavac
manuel-serrano commented 3 months ago

Hi,

Thank you for the report (and thank you for mentioning Make's --shuffle option that I did not know). I don't fully understand your fix but I see that bdb's Makefile is wrong. I'm working on it.

Thanks again,

-- Manuel

NHOrus commented 3 months ago

Basically, I throw explicit dependencies until it stops trying to compile in wrong order. And I also removing cd dir; make antipattern - there's make -C for that. Only thing worse is for list of dirs; cd dir; make - it can swallow errors silently and continue to compile. Instead of stopping nicely and early.

manuel-serrano commented 3 months ago

Ah sure. You are absolutely right. Thanks for your help and your contribution. I will upload a new version soon.