[cfe-dev] Slowness of clang build

Edward Diener eldlistmailingz at tropicsoft.com
Sat Dec 29 14:29:45 PST 2012


On 12/29/2012 4:21 PM, Larry Evans wrote:
> On 12/29/12 10:47, Edward Diener 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.
>>
>> 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 ?
>
> Edward, I just finished a build from the start(i.e. everything had to be
> compiled).  It was done with my system's gcc compiler, AFAICT:
>
> ~/download/llvm/pre-releases/3.2/rc3/download/build_debug $ g++ -v
> Using built-in specs.
> Target: x86_64-linux-gnu
> Configured with: ../src/configure -v --with-pkgversion='Ubuntu
> 4.4.3-4ubuntu5.1'
> --with-bugurl=file:///usr/share/doc/gcc-4.4/README.Bugs
> --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr
> --enable-shared --enable-multiarch --enable-linker-build-id
> --with-system-zlib --libexecdir=/usr/lib --without-included-gettext
> --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.4
> --program-suffix=-4.4 --enable-nls --enable-clocale=gnu
> --enable-libstdcxx-debug --enable-plugin --enable-objc-gc
> --disable-werror --with-arch-32=i486 --with-tune=generic
> --enable-checking=release --build=x86_64-linux-gnu
> --host=x86_64-linux-gnu --target=x86_64-linux-gnu
> Thread model: posix
> gcc version 4.4.3 (Ubuntu 4.4.3-4ubuntu5.1)
>
> And the complete build, with configuration set with:
>
> #!/bin/bash
> this_dir=`pwd`
> $this_dir/../llvm.src/configure \
>    --prefix=$this_dir/../install_debug \
>    --enable-optimized=NO \
>    --enable-assertions=YES \
>    --enable-debug-runtime=YES \
>    --enable-debug-symbols=YES \
>    #

In my ./configure command I gave no options. Perhaps one of the options 
you set makes the building of clang run faster as against whatever 
default options it uses when you do not specify any.

>
> completed in about 1 hr.  I've got 2Gig memory and 2 cpu's
> and plenty of disk space.

When I told 'make' to use all of my processor via 'make -j 4' things 
went appreciably quicker. So it may have finished in an hour if I had 
used that to begin with.





More information about the cfe-dev mailing list