Parallel builds of the ocaml compiler


Rebuilding ocaml itself seems to be fairly slow on my machine because it doesn’t run a parallel build. Is it okay to do “make -j 4 world.opt” and the like, or is that unsupported? INSTALL.adoc is silent on the matter. Similarly is using parallel make supported for the manual?


Parallel builds are known to work well from a clean state (after make clean or make partialclean), but known to be somewhat flaky when used incrementally. I don’t think there is any shared knowledge on the status of parallel build for the manual, your experience reports are welcome.


I did add some precautions to make sure that parallel builds would work correctly while cleaning up the manual’s makefiles, and I tried building it with make -j 4 a few times, so I think it should work reliably.


It would be interesting to figure out why. Regardless, we should probably document that they work correctly if the system starts from a clean state.


When installing a new opam switch, does the compiler get built in parallel? If not, I would vote for enabling that to save everyone some time…


Although it seems to be poorly documented (and that should be fixed!), the .opam/config file defines a jobs: parameter, and it appears (though I can’t quickly confirm) that opam init sets it appropriately for your system.


Even though it’s available in opam files I don’t think you should use that parameter for your build system. IIRC that variable is the maximal number of packages opam itself will build in parallel (dependency order allowing).


Ah, that is indeed somewhat different.