GCC Stack: Colorgcc, CCache, Distcc

For prettifying and speeding up the compilation of your C++ on Linux with GCC it’s relatively common practice to use colorgcc, ccache, and distcc. This page describes the quick couple steps it takes to set up a “gcc stack” that does all the prettifying and speeding up for you. You don’t need to make any changes to the makefile. Just running the old gcc command will also run ccache and colorgcc and distcc if you wish.

Below are the commands from that page. If you need explanation, actually go there.

Create directory “~/bin/”, and in it run:

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

Open “~/.bashrc” and add:

export PATH=~/bin/:$PATH

Open “~/.colorgccrc” and add:

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

Also, as I do, you can take advantage of having multiple processors by running gcc with the –jobs=# flag where # is the number of processors you have (or number of processors plus one, or more if you’re using distcc). How many processors do you have? Run:

grep -c '^processor' /proc/cpuinfo

You can add that to your script or makefile to automatically determine the value passed to the –jobs flag.

Comments

comments

This entry was posted in Linux, Programming and tagged , , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>