[llvm-dev] [FYI] CMake's Ninja generator is non-deterministic

Chris Bieneman via llvm-dev llvm-dev at lists.llvm.org
Wed Feb 10 10:01:56 PST 2016

It is with great sadness that I must tell everyone CMake’s Ninja generator is non-deterministic (https://public.kitware.com/Bug/view.php?id=15968 <https://public.kitware.com/Bug/view.php?id=15968>).

I’m not sure if this impacts all versions of CMake, but it certainly impacts all the recent releases. You might ask why this matters? Sadly the non-determinism *does* impact determinism in the final builds. I haven’t fully dug into the extent of the differences, but I was seeing non-reproducibility in LTO builds. Whatever Ninja is doing differently causes LTO to make different optimization decisions. I have verified that this does not impact CMake’s makefile generator.

The important takeaway from this is that if you are building for a purpose where non-determinism can impact your results, don’t use Ninja. For most engineering tasks building and testing locally Ninja, as always, works great. For incremental bots testing correctness, no problem.

Any bots testing performance need to move to a deterministic generator (i.e. Unix Makefiles). Anyone building or testing a release of LLVM or clang for packaging purposes should also use a deterministic generator.

Sorry to be the bearer of bad news…

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20160210/43c0a7fb/attachment.html>

More information about the llvm-dev mailing list