Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

recursive Make breaks parallelism #51

Open
ygrek opened this issue Aug 2, 2017 · 0 comments
Open

recursive Make breaks parallelism #51

ygrek opened this issue Aug 2, 2017 · 0 comments
Labels
bug Something isn't working major

Comments

@ygrek
Copy link
Member

ygrek commented Aug 2, 2017

Original report by Daniel Kahn Gillmor (Bitbucket: dkgdkg, GitHub: dkgdkg).


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.

@ygrek ygrek added major bug Something isn't working labels May 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working major
Projects
None yet
Development

No branches or pull requests

1 participant