May 17, 2004

ccache and mozilla

mvl asked on #developers what it took to get ccache working with Mozilla. It's pretty easy, so I thought I'd share my setup here:

My Mozilla trees are under /builds, so I configured ccache using these environment variables:

export CCACHE_DIR=/builds/.ccache
export CCACHE_HARDLINK=1

The hardlinks option is really great because it avoid disk copies when the target object file lives on the same partition as the cache.

Next, you need to create symlinks for gcc and c++ (I also created symlinks for cc and g++ to be complete). I put these in ~/bin so that they would override the defaults in /usr/bin. You may need to put them elsewhere or adjust your $PATH accordingly.

Finally, I ran ccache with the following options:

$ ccache -M 2G

This configured ccache to use up to 2 gigibytes of storage. (I don't know, and I don't really care, whether its actually 2 GiB or 2 GB -- either way, it's large enough for my needs!)

And, that's it. You don't have to clobber your Mozilla trees to start using ccache. It's interesting to run "ccache -s" periodically to see the statistics of the cache.

Posted by darin at May 17, 2004 12:06 PM
Comments

Has anyone gotten th ccache working on Windows?

I've tried to add:
CC=ccache gcc

to my .mozconfig file but it doesn't seem to work

Posted by: Henrik Gemal at May 18, 2004 11:57 AM

I haven't tried using it under windows yet.

Posted by: Darin Fisher at May 18, 2004 12:10 PM

If you're using a distribution supported by dag (http://dag.wieers.com/packages/ccache/), you just have to install the RPMs, and then restart your shell to get the $PATH changes.

(N.B., though, that his distcc packages are of 2.14, which has an LZO-encoding bug that you don't want.)

Posted by: shaver at June 19, 2004 12:44 PM