[mythtv] A cautionary tale on the use of ccache

roger roger at beardandsandals.co.uk
Mon Feb 20 15:00:25 UTC 2017


I have recently been building from a number of separate mythtv clone 
repositories on the same machine, each have a number of modifications to 
some files. I recently deleted one of those repos.

I run eclipse CDT as my development environment. I started to experience 
problems with breakpoints when running gdb via eclipse. The source path 
lookup for eclipse is extremely complicated and totally undocumented. 
Running gdb from the command line worked OK and I added source 
directories to the gdb source path as I needed them.

I have just spent a considerable amount of time over the last couple of 
weeks trying work out what mistakes I had made with the eclipse 
configuration. Things just did not make any sense. So I starting tracing 
eclipse interactions with gdb and looking at the debug information in 
various mythtv shared libraries using objdump. I did not notice it at 
first but a eventually realised that all the full absolute source paths 
where pointing to the repo I had deleted!! I then looked at the build 
logs but could not find anything in them that showed this old path being 
given to the build tools. What I could see was that the compilations 
were being done in the correct new directories. So how were this old 
paths getting into the debug info in the executables.

I then remembered that all our compiles are done via ccache. Ok, I 
thought, I will run a distclean and ./configure --previous, that should 
fix it!

Result....the old paths were still there!!!!

I then ran "cache -C".

Result...success.

I you have not changed anything in a source file ccache will think that 
it can give you a cached object file from a compilation done in another 
directory even if the correspond source does not exist any more. You 
will not notice anything amiss until you try debugging something in 
anything but the most simple command line environment.

I think we should put cache -C somewhere in the distclean!

Roger



More information about the mythtv-dev mailing list