From ArchWiki
Revision as of 17:12, 26 July 2011 by Mitch feaster (Talk | contribs) (Enable with colorgcc: fixing rc filename)

Jump to: navigation, search

Tango-document-new.pngThis article is a stub.Tango-document-new.png

Notes: please use the first argument of the template to provide more detailed indications. (Discuss in Talk:Ccache#)


There's a wonderful tool for Template:Codeline called Template:Codeline. 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 Template:Codeline is perfect. While it may take a few seconds longer to compile a program the first time with Template:Codeline, subsequent compiles will be much, much faster.


Template:Codeline 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 Template:Filename. In Template:Codeline 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 Template:Codeline to help speed things up.

For that, you need to change your Template:Codeline to include Template:Codeline's binaries before the path to your compiler.

export PATH="/usr/lib/ccache/bin/:$PATH"

You may want to add this line to your Template:Filename file for regular usage.

Enable with colorgcc

Since colorgcc is also a compiler wrapper, some care needs to be taken to ensure each wrapper is called in the correct sequence.

export PATH="/usr/lib/colorgcc/bin/:$PATH"    # As per usual colorgcc installation, leave unchanged (don't add ccache)
export CCACHE_PATH="/usr/bin"                 # Tell ccache to only use compilers here

colorgcc then needs to be told to call ccache instead of the real compiler. Edit Template:Filename and change all the Template:Filename paths to Template:Filename



You can use the command line utility ccache to...

Show statistics summary:

$ ccache -s

Clear the cache completely:

$ ccache -C

Additional Resources

ccache homepage

ccache documentation

Enjoy faster compiling!