[ccache] -MD flag and absolute path problem

Joel Rosdahl joel at rosdahl.net
Sat Apr 12 10:26:03 MDT 2014


Hi Tal,

Sorry about the delayed answer.

> *when i try to rebuild busybox i get an error:*
> fixdep: /home/*other_user*/................./gcc/....../4.8.0/
include-fixed/limits.h:

ccache relies on the assumption that if the compiler check (by default the
compiler's mtime) is the same then the whole toolchain is the same. If you
use different (locations of the) toolchains but mtimes of the compilers are
the same, then you have to instruct ccache how to properly identify the
compiler by setting CCACHE_COMPILERCHECK to a suitable command, just like
you mentioned. Or, disable the direct mode.

> *(FYI, this could  also happen if my makefile targets were absolute path
> and not relative.....)*

I don't understand what you mean here. If you use CCACHE_BASEDIR, ccache
rewrites absolute paths to relative on the command line, so using absolute
paths in the Makefile shouldn't be an issue. What problem do you see?

> what else can i do???

One option is to use -MMD instead of -MD when compiling so that toolchain
headers don't end up in the .d files at all.

It might be possible to improve ccache to convert absolute paths to
relative paths in .d files in some clever way. Patches are welcome.

-- Joel



On 20 January 2014 18:49, tal zilcer <tal.zilcer at gmail.com> wrote:

> hi,
>
> I use a shared cache over NFS to increase cache hits for users on different
> servers.
>
> *some more info:*
> 1) ccache version is 3.19
> 2) CCACHE_BASEDIR=/home (to get hits from different folders)
> 3) the toolchain is located in the user home folder
>
> *when i try to rebuild busybox i get an error:*
> fixdep:
> /home/*other_user*/................./gcc/....../4.8.0/include-fixed/limits.h:
> No such file or directory
>
> i compile busybox in my home directory /home/*talz*.
> so when i compile i get a cache hit and retrieve the .d file from the cache
> and get /home/*other_user*/.... in the .d file(previous hit by another
> user).
> this is because the -MD flag that causes h files in the toolchain to
> be absolute path in the .d file.
> *(FYI, this could  also happen if my makefile targets were absolute path
> and not relative.....)*
>
> i though about one solution which is to add  the path of the toolchain
> to CCACHE_COMPILERCHECK, resulting in getting cache misses if the toolchain
> is not from the user folder.
> this will of course cause many not code related cache misses which i wish
> to prevent.
> also this will not work if the makefile targets are absolute path.
>
> what else can i do???
>
> thanks,
> tal
> _______________________________________________
> ccache mailing list
> ccache at lists.samba.org
> https://lists.samba.org/mailman/listinfo/ccache
>


More information about the ccache mailing list