I have a question related to ccache configuration. In our development environment we have hundreds of make files that build objects using absolute paths.
I wanted to speed up the process and use ccache. Unfortunately when compiling from different locations I can see cache misses. Below is an example of simplified situation where source files are placed in different directories. How do I have to setup ccache to get the proper hit ratio?
I tried to play with setting the CCACHE_BASEDIR variable with no success:
developer@crunchbang:~$ pwd
/home/developer
developer@crunchbang:~$ ccache -s
cache directory /home/developer/.ccache
cache hit (direct) 0
cache hit (preprocessed) 0
cache miss 0
files in cache 0
cache size 0 Kbytes
max cache size 1.0 Gbytes
developer@crunchbang:~$ ccache g++ -c /home/developer/unique_name1/contest.cpp
developer@crunchbang:~$ ccache g++ -c /home/developer/unique_name2/contest.cpp
developer@crunchbang:~$ ccache -s
cache directory /home/developer/.ccache
cache hit (direct) 0
cache hit (preprocessed) 0
cache miss 2
files in cache 4
cache size 16 Kbytes
max cache size 1.0 Gbytes
developer@crunchbang:~$ ccache g++ -c /home/developer/unique_name1/contest.cpp
developer@crunchbang:~$ ccache g++ -c /home/developer/unique_name2/contest.cpp
developer@crunchbang:~$ ccache -s
cache directory /home/developer/.ccache
cache hit (direct) 2
cache hit (preprocessed) 0
cache miss 2
files in cache 4
cache size 16 Kbytes
max cache size 1.0 Gbytes
developer@crunchbang:~$ ccache --version
ccache version 3.1.7
Copyright (C) 2002-2007 Andrew Tridgell
Copyright (C) 2009-2011 Joel Rosdahl
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
Foundation; either version 3 of the License, or (at your option) any later
version.