TL;DR: When working on better/simpler CMake suport for Clang/LLVM I am often thwarted by one of the most complex parts of the Clang setup: the ability to do a “standalone” build of Clang. I would like to get rid of this feature in order to simplify and make more progress. Any objections?
Most people don’t even know what the “standalone” build is, so in summary it allows you to check out just clang and to build it against a separate checkout and build tree of LLVM. It doesn’t re-use the build output tree of LLVM, or the source tree of LLVM.
Why does this exist? I’ll try to summarize the points from the last time I talked to Doug about it, but honestly, I don’t use this so I may mess it up. I’ve CC-ed Doug who is (I suspect) one of the few using it to clarify anything I miss:
- It allows updating the LLVM source checkout and build tree less frequently than the Clang checkout and build tree.
- It allows sharing a single LLVM checkout and build tree amongst many Clang checkouts and build trees.
Certainly #1 and #2 can (in some cases) combine to improve incremental rebuild speed, but in practice I rarely benefit from them as the time is now heavily dominated by running the test suite. Thus, I see this benefit as diminishing these days, and also as offset by improved performance of CMake, especially when coupled with the bleeding edge ninja system.
Now, why do I want to get rid of this? What is it preventing or getting in the way of?
Remove duplication! Massive amounts of the CMake infrastructure of LLVM are copied into Clang’s CMake build in order for the latter to not depend on the former. What’s worse, these copies have evolved independently and now often diverge, duplicate bugs, and sometimes give birth to their own bugs.
Remove duplication! The ‘lit’ based test running is needlessly duplicated in Clang’s CMake build. It is also incorrect, missing dependencies, and behaving differently from LLVM’s. Yep. ‘make check && make clang-test’ does not in fact test the same thing as ‘make check-all’. Scary, eh?
Integrate with CompilerRT: This comes out of the LLVM projects subtree, and so is inherently missing in a stand-alone build.
Integrate with libc++: Same story as CompilerRT.
Integrate support for automatic bootstrapping: This will be among the most complex things to add to our CMake builds, but also one of the highest value. I’d really like to not spend time thinking about how this interacts with Clang’s standalone cmake bits, but I have to as long as its there.