[ccache] -Bprefix compiler option - resulting in cache miss

vkr venkatakrishnarao.ks at gmail.com
Fri Sep 11 10:02:51 UTC 2015


Hello,
I believe I found a potential bug with ccache that results in cache-miss if
-Bprfix compilation option is used, where prefix specifies where to find
the executables, libraries, include files, and data files of the compiler
itself.

Example, if my compilation command is:
CCACHE_BASEDIR=$PWD ccache gcc -c hello.c -o hello.o
-B$PWD/linkfarm/sysroot-x86_64_cge7/usr/lib64/4.7.0/


then, from what I understand, ccache is considering this argument
-B$PWD/linkfarm/sysroot-x86_64_cge7/usr/lib64/4.7.0/
as well, while creating the basic-hash for direct cache lookup, but without
rewriting it into its relative path based on CCACHE_BASEDIR setting.
Thus, the hash so generated is for the absolute path of this workspace, and
cannot be reused from another build sandbox.

I verified that the changes done in the fork
https://github.com/venkrao/ccache-1/commit/59e5244dd79b0fc7df682c8f3c05b778a3d00f91
fixes the problem.

To verify that -Bprefix is also put into the hash, with its absolute path,
I put a debug statement on the line
https://github.com/venkrao/ccache-1/blob/59e5244dd79b0fc7df682c8f3c05b778a3d00f91/ccache.c#L1594

Please help to verify my understanding and the fix.

Thanks,
Venkat.


More information about the ccache mailing list