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

Joel Rosdahl joel at rosdahl.net
Tue Apr 23 14:30:24 MDT 2013


Hi Mathias,

> # 1 "/home/mdemare/testdir/**target2//" <--- this is an issue!

The basedir feature is supposed to rewrite that path as well, and it seems
to work when I test it using this quick shell script:

=====================================================
#!/bin/sh

mkdir testdir.$$
cd testdir.$$

export CCACHE_DIR=$PWD/ccache.$$
export CCACHE_NODIRECT=1
export CCACHE_BASEDIR=$PWD
ccache=ccache
gcc=/usr/bin/gcc

mkdir a b
touch src.c
(cd a && $ccache $gcc -g -c ../src.c)
(cd b && $ccache $gcc -g -c ../src.c)
$ccache -s
cd ..
rm -rf testdir.$$
=====================================================

When I run it, it prints one cache miss and one preprocessed cache hit. I
tested both ccache 3.1.8 and current master. What happens when you run it?

-- Joel


On 18 April 2013 14:00, Mathias De Maré
<mathias.de_mare at alcatel-lucent.com>wrote:

> On 04/18/2013 01:15 PM, Mathias De Maré wrote:
>
>> 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'.
>>
> Apparently, it's possible to use the gcc option '-fno-working-directory'.
> This gets rid of the issue for the example above.
>
>
> Greetings,
> Mathias
> ______________________________**_________________
> ccache mailing list
> ccache at lists.samba.org
> https://lists.samba.org/**mailman/listinfo/ccache<https://lists.samba.org/mailman/listinfo/ccache>
>


More information about the ccache mailing list