Ccache

From ArchWiki
Revision as of 06:31, 10 July 2009 by Synss (Talk | contribs)

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#)


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

PATH="/usr/lib/ccache/bin:/opt/bin:${PATH}"

Misc

CLI

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

Show statistics summary:

$ ccache -s

Clear the cache completely:

$ ccache -C

More (help page)...

$ ccache -h

Set makepkg cache (size / properties)?

No idea yet. (anyone?)

Additional Resources

ccache homepage

ccache documentation

Enjoy faster compiling!