CMake vs. autotools output differences


I’ve spent some time hacking up the Debian packaging to use CMake instead of autotools; it’s still a work in progress, but it works. It’s a bit of a mess, though, primarily because there are differences in the output of the CMake and autotools builds.

On my Ubuntu machine, the dependencies for clang-3.6 look like this:
$ ldd /usr/bin/clang-3.6 => (0x00007ffc7af57000) => /usr/lib/x86_64-linux-gnu/ (0x00007fe47eac3000) => /lib/x86_64-linux-gnu/ (0x00007fe47e8a5000) => /usr/lib/x86_64-linux-gnu/ (0x00007fe47e596000) => /lib/x86_64-linux-gnu/ (0x00007fe47e380000) => /lib/x86_64-linux-gnu/ (0x00007fe47dfb6000) => /lib/x86_64-linux-gnu/ (0x00007fe47dd9b000) => /usr/lib/x86_64-linux-gnu/ (0x00007fe47db93000) => /usr/lib/x86_64-linux-gnu/ (0x00007fe47d959000) => /lib/x86_64-linux-gnu/ (0x00007fe47d730000) => /lib/x86_64-linux-gnu/ (0x00007fe47d52c000) => /lib/x86_64-linux-gnu/ (0x00007fe47d224000)
/lib64/ (0x00007fe480aa5000)

Using CMake with BUILD_SHARED_LIBS, it looks like this:
(the fact that I used pastebin is a hint)

The main difference is the many LLVM/Clang shared library dependencies, rather than just one. It’s preferred that each shared library is packaged separately, but this would be a bit of a maintenance nightmare; so that would mean one package with many shared libraries in it (more likely, one for all clang shared libraries, and one for all LLVM).

Are the differences between them intentional? Is there any room for change – to have the CMake-build tools link against the monolithic libLLVM as in autotools?

Second, Debian packages want both shared objects and static archives. BUILD_SHARED_LIBS means one or the other. Is there any reason why it would be a bad idea to modify add_llvm_library to create targets for both static and shared, if not specified?


We have a way to produce a (, but we do not have a way yet for clang to link against it. It’s similar to the situation of clang and libclang (

I really think we just need to push through the cmake jungle and make and into real libraries consumed by the various LLVM tools. I think it’s the right granularity for most users, even if it’s not right for everyone. It’s clearly what distro packagers want.

Accidentally replied, instead of reply-all:

Okay. I’m working through a smallish change to add_llvm_executable that links to > instead of the component libs. So far so good, and I think it’s a fairly non-intrusive > change. I’ll propose something soon if it works out.

And if anyone’s interested, I’ve just posted This takes care of libLLVM, but not libclang.