Very long repeated compile time for building LLVM from sources

Hi, everyone! I have some troubles with compilation time, it’s very long after reboot computer or waiting long time.

So, steps for reproduce:

  1. Build LLVM from sources. OK.
  2. Change something in one cpp file. OK.
  3. Build LLVM again. Not a long compile time for that case because I’ve changed only one cpp file, that’s ok. OK.
    But if I reboot computer after changing cpp file or wait some long time and try to build LLVM after that again, compile time will be very long, like in first step. But I’ve changed only one cpp file, and in that case don’t need to recompile all LLVM. Why it’s happens and how can I avoid this?

Cmake command:

cmake -G Ninja ../llvm \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DLLVM_TARGETS_TO_BUILD=X86 \
-DLLVM_ENABLE_PROJECTS=clang \

Ninja command:
ninja -j 4 -l 1

I think there is a way to ask ninja why it rebuild, check “ninja -d list” or “ninja -t list” I think there is a “explain” or “why” command there.

So next time you haven’t built in a while you can have ninja explain it and paste the output here later.

1 Like

Thank you!
I’ve checked it and there are a lot of “dirty” files, which are recompiled.
I still don’t understand why it works this way. Will research.
But definitely problem in ninja, not in LLVM.