is ccache working?

Alexander Neundorf neundorf at kde.org
Tue Aug 3 20:56:02 BST 2010


On Tuesday 03 August 2010, matthew wrote:
> On Sunday 01 August 2010 07:16:05 fabio de francesco wrote:
> > On Sunday 01 August 2010 11:42:29 Andreas Pakulat wrote:
> > > On 01.08.10 11:19:19, fabio de francesco wrote:
> > > > Hi all,
> > > >
> > > > I have the line "export CCACHE_DIR=/home/kdevel/var/tmp/ccache" in my
> > > > /home/kdevel/.bashrc but I don't find any file in that directory. Did
> > > > I miss something needed to make ccache properly working?
> > >
> > > This doesn't really have anything to do with KDE, you need to make sure
> > > that gcc/g++/... are pointing to ccache and not the real compiler.
> > > Usually this is done by setting up apropriate symlinks called gcc/g++
> > > somewhere in a directory and putting that directory first in PATH.
> > >
> > > Andreas
> >
> > I see that /usr/bin/gcc is not a symbolic link to ccache, anyway ccache
> > is working system wide and it regularly writes caches to /var/tmp/ccache.
> > By using "find /var/tmp/ccache -cmin 60" I see that these files are
> > regularly updated when I compile programs with Gentoo's "emerge world".
> > Because of ccache working with system updates I wouldn't make links that
> > can break things as they are now.
> >
> > Therefore I've made both /home/kdevel/bin/g++ and /home/kdevel/bin/gcc
> > symbolic links to /usr/bin/ccache. The /home/kdevel/bin directory is the
> > first listed in $PATH for the kdevel user. After doing this I re-compiled
> > kdelibs as kdevel user and then I checked /home/kdevel/var/tmp/ccache,
> > but the directory is still empty.
> >
> > I think this problem is KDE related because the advice to export
> > CCACHE_DIR in ~/.bashrc is taken from the tutorial in developing KDE from
> > the
> > techbase.kde.org site.
> >
> > Please, what am I missing?
> >
> > Regards,
> >
> > fabio
>
> One thing to take note of, cmake, when first runs, stores the complete path
> to gcc in the CMakeCache.txt.  It will not update this value normally. 
> Even if the path changes, it remains constant.  So adding ccache to your
> path will *not* make KDE's build use ccache.  You either have to manually
> replace the value (as far as I know, unsupported and dangerous), or
> recreate your build directory.  I seem to remember reading about this
> behaviour inside of cmake's documentation, so I don't think this is KDE
> specific.

Yes, that's correct.
CMake stores the full path to the compiler in the cache, and you should not 
manually change that.
All other values in the cache, like the results of try_compile() etc., have 
been produced with that compiler, if you change the compiler, they all might 
be wrong. So, don't (manually) change the compiler in an existing build tree.

Alex





More information about the kde-core-devel mailing list