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

"De Mare, Mathias (Mathias)" <[email protected]>
Newsgroups gmane.comp.compilers.ccache
Message-ID <E6B37B37C6F8284795EEB426C1284A13012173@FR711WXCHMBA01.zeu.alcatel-lucent.com>
Hello Joel,

Thanks for helping!

I just tried your script, and I also get 1 cache miss and 1 preprocessed cache hit.
I'm wondering if I made a mistake in my original test by configuring the CCACHE_BASEDIR incorrectly.

So looks like the issue was me, sorry for bothering!

Greetings,
Mathias

From: [email protected] [mailto:[email protected]] On Behalf Of Joel Rosdahl
Sent: dinsdag 23 april 2013 22:30
To: De Mare, Mathias (Mathias)
Cc: ccache list
Subject: Re: [ccache] Multiple targets with preprocessor mode and -g (was Re: Single 'source' collection, multiple targets)

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é <[email protected]<mailto:[email protected]>> 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
[email protected]<mailto:[email protected]>
https://lists.samba.org/mailman/listinfo/ccache
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.