On Dec 24, 2:06 am, Mike Shal <
mar...@gmail.com> wrote:> On Wed, Dec
21, 2011 at 5:20 AM, Slawomir Czarko> > <
slawomir.cza...@gmail.com>
Hi,
In theory ccache shouldn't be needed when using tup since tup should
make sure that the compiler shouldn't run at all if sources haven't
been modified. But if you do full builds for some reason then it does
help since ccache will reduce full build times. I think once I finish
porting the build system from make to tup then full builds will stop
or at least become very rare.
When using ccache + tup you need to export CCACHE_BASEDIR before
running ccache. It should be set to the top level directory of your
source files. Without that ccache doesn't really work with tup since
the path to source is different each time tup runs so you end up
having cache misses all the time in ccache. You can verify whether
ccache+tup works correctly by running "ccache -s" before and after
build. If sources were not modified then you should see increase in
"cache hit" and no increase in "cache miss". CCACHE_BASEDIR can be
useful also when not using tup if you compile the same/similar sources
in different directories.
The drawbacks of using CCACHE_BASEDIR are:
· If you specify an absolute path to the source code file,
__FILE__ macros will be expanded to a relative path instead.
· If you specify an absolute path to the source code file and
compile with -g, the source code path stored in the object file may
point to the wrong directory, which may prevent debuggers like
GDB from finding the source code. Sometimes, a work-around is to
change the directory explicitly with the “cd” command in GDB.
The other two environment variables used with ccache are CCACHE_DIR
and CCACHE_PREFIX.
CCACHE_DIR must be exported if you have ccache files in a different
location than ~/.ccache. Without exporting it ccache will use the
default location when running with tup.
CCACHE_PREFIX must be exported if you are using any other compiler
wrapper like for example distcc. Without exporting it the other
compiler wrapper will not be used.
- Slawomir