Contents

Introduction

There's a wonderful tool for gcc called ccache. You can read about it at their home page.

If you're always compiling the same programs over and over again -- such as trying out several kernel patches, or testing your own development -- then ccache is perfect. While it may take a few seconds longer to compile a program the first time with ccache, subsequent compiles will be much, much faster. Obviously, this won't help everyone.

Installation

Anyway, there happens to be an Arch package for ccache in the Extra repository.

pacman -S ccache

Enable ccache for makepkg

To enable ccache when using makepkg edit /etc/makepkg.conf. In BUILDENV remove exclamation mark before ccache and it will enabled. For example:

BUILDENV=(fakeroot !distcc color ccache !xdelta)

Note: If you are compiling for example KDE you have to disable export CPP and export CXX - it prevents from some errors

Enable for command line

If you're compiling your code from the command line, and not building packages, then you'll still want to use ccache to help speed things up so add this to your /home/<user>/.bash_profile