[cfe-dev] Slowness of clang build

David Blaikie dblaikie at gmail.com
Sat Dec 29 09:02:24 PST 2012


On Sat, Dec 29, 2012 at 8:47 AM, Edward Diener
<eldlistmailingz at tropicsoft.com> wrote:
> I am periodically retrieving the latest sources from the llvm/clang
> repository, as specified in the Getting Started page.
>
> When I do a build of clang, through the 'make' command from the build
> directory, the build runs very slow. Evidently the default is a Debug+Assert
> build. Compiling a single source file averages 5-10 seconds and overall the
> build takes hours considering how many modules must be built. It is all
> successful in the end and when I am finished I have the latest clang, which
> is great.
>
> I have plenty of memory, plenty of disk space, a fairly fast CPU, and am
> doing the build on Fedora 17 with hardly any other applications running.

Could you be more specific about the CPU, cores, and available memory?
(have you watched the utilization while building Clang? Is the build
topping out on RAM/using swap? using all your CPU cores?)

The simplest thing to do is probably to pass "-j N" where N is the
number of cores you have available (by default the make build isn't
parallelized).

Other ideas:
* what compiler are you using to perform the build? If it's a previous
Debug+Asserts build of Clang, then that's really going to slow things
down - don't use that, use Release+Asserts or Release-Asserts.
* you could try the cmake+ninja build (ninja will run maximally
parallel by default & exploits more parallelism than the make build)
* to do a release build of clang (which might speed things up a little
since you won't be dealing with debug info, etc) I think it's
"--disable-optimized" when configuring the make based build

>
> Why is compiling clang so slow ? Is there any way to speed up the build ? If
> I do a release build ( how ? )is it significantly quicker ?
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev



More information about the cfe-dev mailing list