Gcc-stack: Difference between revisions

From TUDOS-Wiki
Jump to navigationJump to search
Ron (talk | contribs)
add page on how to combine colorgcc, ccache, and distcc
 
Ron (talk | contribs)
→‎CCache: changes made in colorgcc version 1.3.2-5
Line 25: Line 25:


It's important to use the full path to gcc and g++ here, because otherwise gcc and g++ from your local bin directory would be used again. If you have additional links for gcc to colorgcc you should add those as well.
It's important to use the full path to gcc and g++ here, because otherwise gcc and g++ from your local bin directory would be used again. If you have additional links for gcc to colorgcc you should add those as well.
'''''Note''''': with colorgcc version 1.3.2-5 this construct is no longer possible because the executable matching rules have been made stricter. Also something like:
gcc-4.1: ccache /usr/bin/gcc-4.1
gcc-4.2: ccache /usr/bin/gcc-4.2
will no longer work. You may only use one of ''cc'', ''c++'', ''gcc'', ''g++'', ''g77'', ''f77'', or ''gcj''.


=== Dist-CC ===
=== Dist-CC ===

Revision as of 16:18, 26 October 2007

Color-GCC

When parsing the output of gcc it is often useful to get some hints on what is important and what is not. The colorgcc tool does a great job in parsing the output of gcc and making errors and warnings appear in dominant colors.

To use colorgcc install the software, then create links in your personal bin directory to the colorgcc binary with the name of the gcc version you use:

~/bin/ > ln -s /usr/bin/colorgcc gcc
~/bin/ > ln -s /usr/bin/colorgcc g++

Then add your personal bin directory as the first directory into your search path variable (PATH), e.g., by adding the following line to your .bashrc:

export PATH=~/bin/:$PATH

I do have additionally links for the different versions of gcc to enable the use of colorgcc for them as well:

~/bin/ > ln -s /usr/bin/colorgcc gcc-4.2
~/bin/ > ln -s /usr/bin/colorgcc g++-4.2

CCache

ccache is a program that caches the output of gcc invocations. If the input of a gcc invocation does not change, the cached output is used instead of invoking gcc again. This can tremendously speed up recompiles of your L4 tree. To use ccache you may either alias your gcc command to call ccache gcc instead. To combine ccache with colorgcc write the following lines into the file ~/.colorgccrc:

gcc: ccache /usr/bin/gcc
g++: ccache /usr/bin/g++

It's important to use the full path to gcc and g++ here, because otherwise gcc and g++ from your local bin directory would be used again. If you have additional links for gcc to colorgcc you should add those as well.

Note: with colorgcc version 1.3.2-5 this construct is no longer possible because the executable matching rules have been made stricter. Also something like:

gcc-4.1: ccache /usr/bin/gcc-4.1
gcc-4.2: ccache /usr/bin/gcc-4.2

will no longer work. You may only use one of cc, c++, gcc, g++, g77, f77, or gcj.

Dist-CC

distcc is another tool that can speed up your compile process. Dist-CC distributes the invocations of gcc to other servers running the distccd daemon. This way you can utilize other computers to compile your source tree for you. This is especially useful if you can build in parallel. Please follow the instructions on the distcc homepage on how to set up a distcc network. To combine the invocation of distcc with colorgcc and ccache add the following line to your .bashrc (or appropriate):

export CCACHE_PREFIX="distcc"

This will make ccache invoke distcc with the gcc command line itself received. While editing .bashrc, you might as well add an appropriate distcc configuration line:

export DISTCC_HOSTS='localhost/3 compile-host1/4 compile-host2/4'

Have fun!