Switching LLVM CMake build to use explicit dependencies, and completely removing implicit dependency re-generation

Oscar, after working for several hours to fix two intertwined bugs in the dependencies generated for LLVM, I can’t fix it fully. I can teach the scripts to detect vtable dependencies, but there are other dependencies being missed as well.

Fundamentally, the fact that we’ve had to hack around one implicit dep failure in the CMakeFiles themselves is indicative that this system isn’t working.

I’m now working on completely removing this aspect of LLVM’s CMake build, and replacing it with explicit dependencies, spelled out locally to each CMake target. I think this is the best strategy going forward for the following reasons:

  1. It can express dependencies we can’t auto-detect such as TableGen dependencies.
  2. It isn’t subject to optimization levels or toolchains.
  3. It is easier to update for those not using CMake: the references of note are located locally to the code being changed.
  4. Fundamentally, there aren’t enough libraries for these to change rapidly or often. Therefore, it seems very unlikely this will be a major maintenance burden (especially compared with the burden of maintaining explicit source file lists).

After several discussions on IRC, almost every user of CMake there agreed with this move. Doug and I both have advocated for this for a long time.

My plan is to check this in somewhat as an experiment, and explicitly tell non-CMake users to not worry about updating them. Myself and a few others who are constantly using CMake can maintain them and make sure they don’t become a huge burden to update.

Any objections, shout out now! =D I’m hoping to do this really really soon as my builds and several others are completely broken due to failures not fixed by the patch you committed.

-Chandler

Chandler Carruth <chandlerc@google.com> writes:

[snip]

Any objections, shout out now! =D

Yes, I have objections. This was already discussed with Doug on the past
and I won't waste my time rehashing the topic. Just one observation: it
would be a big mistake to not make the same switch on the traditional
build as well. Why? because the automatic library dependency detection
system is the same and because people will not remember to update the
library dependencies in cmake if they are not required to update them in
the makefiles too.

I'm hoping to do this really really soon as my builds and several
others are completely broken due to failures not fixed by the patch
you committed.

If this change fixes problems with the build (as much as I'll like to
see the corresponding bug reports) the Right Thing is to apply it.

I retire from the informal role of maintainer of the cmake build, not in
disgust, but just due to differences of opinion about how the build must
work to provide the best service to its users.

As a LLVM user I will be happy as long as the build works. Otherwise
I'll mail-bomb you with bug reports :slight_smile: