[ccache] Multiple targets with preprocessor mode and -g (was Re: Single 'source' collection, multiple targets)

Mathias De Maré mathias.de_mare at alcatel-lucent.com
Thu Apr 18 05:15:08 MDT 2013

On 11/11/2012 06:15 PM, Joel Rosdahl wrote:
> On 9 November 2012 15:48, Mathias De Maré
> <mathias.de_mare at alcatel-lucent.com> wrote:
>> [...]
>> Is there any other way to achieve the desired effect?
> As you already mentioned, building identical objects only once or
> changing working directory to the target directory would solve the
> problem. I have no other ideas, sorry.
I was able to modify our build system to support this way of working.
I now build inside the target directory, using symlinks to the sources.

Now, I actually have another issue which is partly related.
It seems building for multiple targets with the preprocessor mode and 
compiler option '-g' doesn't work for us.
The preprocessed file contains the location where the build is executed.
An example:
> # 1 "src/foo.cpp"
> # 1 "/home/mdemare/testdir/target2//" <--- this is an issue!
> # 1 "<built-in>"
> # 1 "<command-line>"
> # 1 "src/foo.cpp"
> int main() {
>     return 0;
> }
If I build for one target in '/home/mdemare/testdir/target1' and for 
another target in '/home/mdemare/testdir/target2', this results in a 
cache miss.
Using the direct mode (since there is no preprocessing), this issue does 
not occur.

I'm not 100% sure, but I think this is something that ccache should 
change when using 'CCACHE_BASEDIR'.

Note 1: I am not setting the CCACHE_HASHDIR variable.
Note 2: I cannot use direct mode due to bug 8424.
Note 3: I am using ccache 3.1.8.


More information about the ccache mailing list