How it works?
How to install it?
Easy on Ubuntu:
$ sudo apt-get install ccache
Then change you PATH to point to the Ccache gcc (not just gcc) version:
$ export PATH="/usr/lib/ccache:$PATH"
Check with:
$ which gcc
/usr/lib/ccache/gcc
Done!!!
How can I know if it works?
You can re-compile something and check if CCache is working with ccache -s command, you should have some cache hits:
$ ccache --max-size=5G
Troubleshooting: Re-compiling Linux kernel never hit the cache?
Check if the flag CONFIG_LOCALVERSION_AUTO is set in you menuconfig, disable it and try again.
This flag seems to change a core header file as it appends the git version to the version string automatically, forcing CCache to recompile almost it all.CCache with Icecc (edited):
If you want to use CCache with Icecc (that I'll explain about it in another post) to speed up even more your compilation time, use CCACHE_PREFIX=icecc (thanks Joel Rosdahl who commented about this)
$ export
CCACHE_PREFIX=icecc
NOTE: You don't need to add icecc
/usr/lib/icecc/bin in your PATH
Hi!
ReplyDeleteJust a note on combining ccache and icecream: There are a couple of drawbacks with using the masquerading technique for both tools. The preferred way of using ccache + icecream is to set CCACHE_PREFIX=icecc and then use ccache like before. Here are some more information and details: https://ccache.samba.org/manual.html#_using_ccache_with_other_compiler_wrappers
Regards,
Joel - ccache maintainer :-)
Hi!
DeleteThank you a lot for your comment (and sorry for my late reply), I just updated the post (and my working environment) with this information.
Thanks again
Regards
Hi, Thanks a lot:)
ReplyDeleteI found out that when compiling the kernel with ccache it does not color the warnings/errors. For that had to run "export GCC_COLORS=1"