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

Chandler Carruth chandlerc at google.com
Wed Jul 27 21:11:19 PDT 2011

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

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
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.


On Wed, Jul 27, 2011 at 8:16 PM, Chandler Carruth <chandlerc at google.com>wrote:

> On Wed, Jul 27, 2011 at 7:33 PM, Oscar Fuentes <ofv at wanadoo.es> wrote:
>> Explicitly declare a library dependency of LLVM*Desc to
>> LLVM*AsmPrinter.
>> GenLibDeps.pl fails to detect vtable references. As this is the only
>> referenced symbol from LLVM*Desc to LLVM*AsmPrinter on optimized
>> builds, the algorithm that creates the list of libraries to be linked
>> into tools doesn't know about the dependency and sometimes places the
>> libraries on the wrong order, yielding error messages like this:
> Ahh, I see, you handled like this.
> This really doesn't work. Clearly our automated process is deeply flawed if
> it can't handle this. Have you been looking at *why* it can't handle it? Are
> you trying to figure out the root cause?
> (I have been for the past 2 hours, which is why I haven't committed a fix
> yet...)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20110727/ddb20007/attachment.html>

More information about the llvm-dev mailing list