recursive Make breaks parallelism

Issue #51 new
Daniel Kahn Gillmor
created an issue

The current Makefile arrangement uses recursive make to descend into the bdb directory. but Recursive Make Considered Harmful.

Here's one way that it can fail intermittently, when using -j2 (parallel):

make bdbclean clean && make -j2 bdb/bdb.cma bdb/bdb.cmxa
cd bdb && make clean
make[1]: Entering directory '/home/dkg/src/sks/sks.dkgbb/bdb'
rm -f *.cm*
rm -f *.a *.o
rm -f bdb.ml
rm -f ocextr
make[1]: Leaving directory '/home/dkg/src/sks/sks.dkgbb/bdb'
rm -f *.cm[iox]
rm -f *.annot
rm -f *.opt
rm -f *.bc
rm -rf spider sksclient
rm -f sks sks_add_mail sks.8.gz sks.bc sks_add_mail.bc sks.8.gz
rm -f *.o
rm -f prepared
rm -f sks.8.gz
cd bdb && make bdb.cma
cd bdb && make bdb.cmxa
make[1]: Entering directory '/home/dkg/src/sks/sks.dkgbb/bdb'
make[1]: Entering directory '/home/dkg/src/sks/sks.dkgbb/bdb'
ocamlfind ocamlc -o ocextr ocextr.ml
ocamlfind ocamlc -o ocextr ocextr.ml
File "ocextr.ml", line 1:
Error: The file ocextr.cmo is not a bytecode object file
Makefile:37: recipe for target 'ocextr' failed
make[1]: *** [ocextr] Error 2
make[1]: Leaving directory '/home/dkg/src/sks/sks.dkgbb/bdb'
Makefile:266: recipe for target 'bdb/bdb.cma' failed
make: *** [bdb/bdb.cma] Error 2
make: *** Waiting for unfinished jobs....
cc -O3 -Werror-implicit-function-declaration -I`ocamlc -where`   -I . -c bdb_stubs.c
./ocextr bdb_stubs.c > bdb.ml
ocamlfind ocamlopt    -inline 40 -c bdb.ml
ocamlmklib -custom -o bdb bdb_stubs.o
ocamlmklib -custom -o bdb bdb.cmx -lbdb -ldb
make[1]: Leaving directory '/home/dkg/src/sks/sks.dkgbb/bdb'
2 $

what's happening here is that the sub-make processes get invoked at the same time, don't know about each other, and try to build the exact same thing at the same time. One of the compilation steps complains about the other compilation clobbering a file out from under it.

One way to fix this would be to move all the dependency and build information entirely into a single makefile.

Another way would be to depend on an external ocaml bdb library, rather than shipping our own.

Comments (0)

  1. Log in to comment