[llvm-dev] difference with autotools, cmake and ninja building methods

Arno Bastenhof via llvm-dev llvm-dev at lists.llvm.org
Mon Nov 30 23:14:38 PST 2015

When it comes to build time, I ran into similar issues the first time
(quite recently, in fact) that I tried to compile LLVM and Clang in
accordance with the Clang getting started document. After some
searching, I found the following blog posts containing various tips
for speeding up your build:


Some suggestions therein (incl. the parameters to pass to cmake for
each bullet point):
* As already mentioned, use ninja instead of make. (-G "Ninja")
* Build with Clang instead of GCC. Rather than doing the bootstrapping
yourself, you can also download the binaries for a previous release
and then use these for building the snapshot version. (e.g.,
* If you're mainly interested in Clang, you can restrict the number of
targets to build for. (e.g., -DLLVM_TARGETS_TO_BUILD="X86")

The referenced blog posts provides many more suggestions, but by using
the above I was able to bring my build time down from over two hours
to 'only' 42 minutes (although I read stories online from people who
need less than 15 minutes for a full build, so perhaps I still missed

I'd be happy to hear about any further tips.

On 11/30/15, Chris Bieneman via llvm-dev <llvm-dev at lists.llvm.org> wrote:
>> On Nov 29, 2015, at 9:09 PM, 慕冬亮 <mudongliangabcd at gmail.com> wrote:
>> 2015-11-30 12:58 GMT+08:00 Chris Bieneman <beanz at apple.com
>> <mailto:beanz at apple.com>>:
>>> The autotools build system is officially deprecated and will be removed
>>> in a
>>> future release.
>>> CMake is the recommended configuration system, but it is only a
>>> configuration system. It generates build files for multiple different
>>> build
>>> systems. One of the most popular build systems is Ninja. You cannot
>>> build
>>> LLVM with Ninja without using CMake, but CMake doesn’t require Ninja.
>>> You
>>> can use CMake to generate Makefiles as well as Xcode and Visual Studio
>>> projects, and more.
>> I often used cmake to compile llvm and clang. But I found a boring
>> problem: when I update all the repositories - llvm,clang,compiler-rt
>> and try to recompile, but I can't compile source code successfully
> Do you mean when you update the repositories you can’t compile llvm, clang,
> and compiler-rt? Do you have a specific error? Keep in mind the llvm, clang,
> and compiler-rt repositories need to be kept in sync. You can’t update one
> without updating them all.
>> and
>> it takes me much time to recompile.
> The clang compiler is a quite large source project, depending on your
> hardware it may take a while to compile. Ninja is better than any other tool
> that I’m aware of at minimizing the work required during incremental
> builds.
> -Chris
>> Does anyone has advice about this
>> problem?
>>> This page has the LLVM project’s documentation on using CMake:
>>> http://llvm.org/docs/CMake.html
>>> -Chris
>>> ile.
>>> On Nov 29, 2015, at 7:52 PM, 慕冬亮 via llvm-dev <llvm-dev at lists.llvm.org>
>>> wrote:
>>>   When I see one book about llvm and choose the building method
>>> between autotools, cmake, and ninja building methods, I was confused.
>>> Is there any link about this content?
>>>   Thanks for reply.
>>> --
>>> My best regards to you.
>>>    No System Is Safe!
>>>    mudongliang
>>> _______________________________________________
>>> LLVM Developers mailing list
>>> llvm-dev at lists.llvm.org
>>> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
>> --
>> My best regards to you.
>>     No System Is Safe!
>>     mudongliang

More information about the llvm-dev mailing list