Ccache
From ArchWiki
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.
Installation
ccache is available as a package in the extra repository. In order to install it, run
# 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.
For that, you need to change your $PATH to include ccache's binaries before the path to your compiler.
export PATH="/usr/lib/ccache/bin/:$PATH"
Misc
CLI
You can use the command line utility ccache to...
Show statistics summary:
$ ccache -s
Clear the cache completely:
$ ccache -C
Additional Resources
Enjoy faster compiling!