llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
27.76k stars 11.43k forks source link

[Runtimes] Builtins target forces runtime targets to reconfigure every build #98897

Open jhuber6 opened 1 month ago

jhuber6 commented 1 month ago

Using LLVM_ENABLE_RUNTIMES creatures nested CMake projects that the main interface will update. Currently, these nested projects will reconfigure every time ninja is run, even when nothing has changed in the project itself. This wastes a lot of time, especially when maintaining multiple targets at once.

After doing some digging, I've found that it's caused by the builtins dependency on the runtimes target. If compiler-rt isn't included or the builtins dependency isn't added, then the problem goes away. It seems that the ExternalProject_Add interface makes CMake think the builtins target is modified after we complete its build step, which triggers the reconfigure on the runtime.

jhuber6 commented 1 month ago

@llvm-beanz @petrhosek Any ideas how we could resolve this? It's becoming very time consuming to wait ~30 seconds for CMake to reconfigure even when nothing has changed. Presumably we can't just remove the dependency because someone might actually modify the builtins and force the reconfigure step?

jhuber6 commented 1 month ago

I'm going to guess that this is an interaction between the BUILD_ALWAYS 1 option we pass to ExternalProject_Add and the dependency on it. Because the runtimes target with always build, we will always be out of date and require a reconfigure. I wonder if there's a way we could work around this.