Re: [ccache] ccache - .d files with absolute system header paths

2017-09-20 Thread Karanam Suryanarayana Rao Venkata Krishna via ccache
Hello,
Actually, the google aosp code has the schema I mentioned.
I just don't want to change it in our makefiles(nor can I influence the
upstream)
(they use clang)

As far as my patch, I used objdump to see that there are no absolute paths.

Thanks,
Venkat.

On Sat, Sep 16, 2017 at 1:16 PM, Anders Björklund via ccache <
ccache@lists.samba.org> wrote:

> Karanam Suryanarayana Rao Venkata Krishna wrote:
> > Hello,
> > I think I discovered a scenario that results in cache misses in spite of
> > using CCACHE_BASEDIR.
> > Consider the following command:
> >
> > CCACHE_BASEDIR=$PWD /bin/bash -c "ccache clang++
> > -fdebug-prefix-map=/proc/self/cwd= -g -c -MD -MF hello.d -o hello.o
> > hello.cpp"
> >
> > It seems to me that is is perfectly alright to ask for debug prefix
> mapping
> > like: "-fdebug-prefix-map=/proc/self/cwd="
> > Unfortunately, ccache is ending up hashing gnu_getcwd(); thus, even
> though
> > we use CCACHE_BASEDIR setting, such a cache cannot be shared by other
> > users' from different workspaces resulting in cache misses.
> ...
> >
> > If the string after "=" in the mapping is null string, then, I hash "./".
>
> Can't you just use "$PWD" and ".", instead of this elaborate scheme ?
>
> Especially since using /proc/self/cwd doesn't even work, not with GCC...
> i.e. when you give that prefix, it will just look for that path string
>
> In the actual debug info, you will _still_ have a reference the cwd.
>
> /Anders
> ___
> ccache mailing list
> ccache@lists.samba.org
> https://lists.samba.org/mailman/listinfo/ccache
>
___
ccache mailing list
ccache@lists.samba.org
https://lists.samba.org/mailman/listinfo/ccache


Re: [ccache] ccache - .d files with absolute system header paths

2017-09-16 Thread Anders Björklund via ccache
Karanam Suryanarayana Rao Venkata Krishna wrote:
> Hello,
> I think I discovered a scenario that results in cache misses in spite of
> using CCACHE_BASEDIR.
> Consider the following command:
> 
> CCACHE_BASEDIR=$PWD /bin/bash -c "ccache clang++
> -fdebug-prefix-map=/proc/self/cwd= -g -c -MD -MF hello.d -o hello.o
> hello.cpp"
> 
> It seems to me that is is perfectly alright to ask for debug prefix mapping
> like: "-fdebug-prefix-map=/proc/self/cwd="
> Unfortunately, ccache is ending up hashing gnu_getcwd(); thus, even though
> we use CCACHE_BASEDIR setting, such a cache cannot be shared by other
> users' from different workspaces resulting in cache misses.
...
> 
> If the string after "=" in the mapping is null string, then, I hash "./".

Can't you just use "$PWD" and ".", instead of this elaborate scheme ?

Especially since using /proc/self/cwd doesn't even work, not with GCC...
i.e. when you give that prefix, it will just look for that path string

In the actual debug info, you will _still_ have a reference the cwd.

/Anders
___
ccache mailing list
ccache@lists.samba.org
https://lists.samba.org/mailman/listinfo/ccache


Re: [ccache] ccache - .d files with absolute system header paths

2017-09-06 Thread Karanam Suryanarayana Rao Venkata Krishna via ccache
Hello,
I think I discovered a scenario that results in cache misses in spite of
using CCACHE_BASEDIR.
Consider the following command:

CCACHE_BASEDIR=$PWD /bin/bash -c "ccache clang++
-fdebug-prefix-map=/proc/self/cwd= -g -c -MD -MF hello.d -o hello.o
hello.cpp"

It seems to me that is is perfectly alright to ask for debug prefix mapping
like: "-fdebug-prefix-map=/proc/self/cwd="
Unfortunately, ccache is ending up hashing gnu_getcwd(); thus, even though
we use CCACHE_BASEDIR setting, such a cache cannot be shared by other
users' from different workspaces resulting in cache misses.

I tested the following code to fix this problem(there by making such a
cache sharable) I'm looking forward to your feedback on this.

--- ccache-3.3_orig/ccache-3.3/ccache.c2016-08-27 16:57:18.0
+0200
+++ ccache-3.3/ccache.c2017-09-06 11:21:06.065818333 +0200
@@ -1525,6 +1525,11 @@
 free(cwd);
 cwd = dir;
 }
+if (strcmp(new, "") == 0) {
+   cc_log("forReview: empty string on the
right size of debug_prefix_map: %s", debug_prefix_map);
+   cwd = format("%s/", ".");
+   cc_log("forReview: Hence, hashing '%s'
as CWD", cwd);
+}
 free(old);
 free(new);

If the string after "=" in the mapping is null string, then, I hash "./".

regards,
Venkat.


On Mon, Sep 4, 2017 at 4:24 PM, Joel Rosdahl  wrote:

> Hi Karanam,
>
> > From just ccache's point of view, is there a way to force relative
> paths into the
> > .d files at all?
>
> Yes, ccache version 3.3 and newer knows how to do this. See the release
> notes for ccache 3.3: http://ccache.samba.org/
> releasenotes.html#_ccache_3_3
>
> -- Joel
>
___
ccache mailing list
ccache@lists.samba.org
https://lists.samba.org/mailman/listinfo/ccache


Re: [ccache] ccache - .d files with absolute system header paths

2017-09-04 Thread Joel Rosdahl via ccache
Hi Karanam,

> From just ccache's point of view, is there a way to force relative paths into
the
> .d files at all?

Yes, ccache version 3.3 and newer knows how to do this. See the release
notes for ccache 3.3: http://ccache.samba.org/releasenotes.html#_ccache_3_3

-- Joel
___
ccache mailing list
ccache@lists.samba.org
https://lists.samba.org/mailman/listinfo/ccache