Created attachment 9300 [details] testcase hi, i've observed that cache produces different manifests for the same input compiled from different locations. looks like a bug while CCACHE_BASEDIR and --ccache-skiped -fdebug-prefix-map... are in action. output objects are the same but cache miss == 2. $ ./build.sh + pwd + export 'CCACHE_DIR=/home/users/pawels/ccache-bug/cache' + unset CCACHE_COMPRESS + export 'CCACHE_LOGFILE=ccache.log' + rm -rf /home/users/pawels/ccache-bug/cache ccache.log '*.s' + ccache -C -z -M 4G Cleared cache Statistics cleared Set cache size limit to 4.0 Gbytes + CXXFLAGS='-Wall -gno-record-gcc-switches -g2 -gdwarf-4' + pwd + export 'CCACHE_BASEDIR=/home/users/pawels/ccache-bug/repo/branch1/' + ccache g++ -Wall -gno-record-gcc-switches -g2 -gdwarf-4 repo/branch1/t.cpp --ccache-skip '-fdebug-prefix-map=repo/branch1/=' -c + mv t.o t1.o + ccache -s cache directory /home/users/pawels/ccache-bug/cache cache hit (direct) 0 cache hit (preprocessed) 0 cache miss 1 files in cache 2 cache size 8 Kbytes max cache size 4.0 Gbytes + pwd + export 'CCACHE_BASEDIR=/home/users/pawels/ccache-bug/repo/branch2/' + ccache g++ -Wall -gno-record-gcc-switches -g2 -gdwarf-4 repo/branch2/t.cpp --ccache-skip '-fdebug-prefix-map=repo/branch2/=' -c + mv t.o t2.o + ccache -s cache directory /home/users/pawels/ccache-bug/cache cache hit (direct) 0 cache hit (preprocessed) 0 cache miss 2 files in cache 4 cache size 16 Kbytes max cache size 4.0 Gbytes + find /home/users/pawels/ccache-bug/cache -type f -name '*.manifest' + xargs md5sum b18264b9076fc983ac70ead6a8779a70 /home/users/pawels/ccache-bug/cache/0/4/3a41ce35bfd105feb336be8732e239-280.manifest 4decca082c24987426aa552a600ddfb0 /home/users/pawels/ccache-bug/cache/7/c/190c559869d5214e2fde8964d277fc-280.manifest + xargs md5sum + find /home/users/pawels/ccache-bug/cache -type f -name '*.o' f75e0cb8ba5af299ea38988c40b8be33 /home/users/pawels/ccache-bug/cache/8/e/cb9b9d37107aaa9d87187f2b2ad9b3-90907.o f75e0cb8ba5af299ea38988c40b8be33 /home/users/pawels/ccache-bug/cache/f/5/e13df936f7465a2445b7e183c354f3-90907.o + md5sum t1.o t2.o f75e0cb8ba5af299ea38988c40b8be33 t1.o f75e0cb8ba5af299ea38988c40b8be33 t2.o
Hi, that's very interesting, because we saw the same in our nightly build system. The path of the install area (but not the build area) contains the weekday of the compilation and we got only cache misses. We also used --ccache-skip followed by a -fdebug-prefix-map=a=b FYI - we are now trying a different approach which works on libraries, so where ccache does not interfere. This is based on the debugedit tool which on RedHat is in the rpm-build package. We should know more in a few days.
(In reply to comment #1) > Hi, > > that's very interesting, because we saw the same in our nightly build system. > The path of the install area (but not the build area) contains the weekday of > the compilation and we got only cache misses. We also used --ccache-skip > followed by a -fdebug-prefix-map=a=b > > FYI - we are now trying a different approach which works on libraries, so where > ccache does not interfere. This is based on the debugedit tool which on RedHat > is in the rpm-build package. We should know more in a few days. i've hacked this problem (see attached diff) but there're other problems like: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58767 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59105
Created attachment 9412 [details] hack/workaround
--ccache-skip has never been intended to have the effect of not hashing the option, but I agree that it sounds reasonable to make it behave that way. Due to the way option handling is done, it's unfortunately a bit complicated to implement, but it should be doable.
(In reply to comment #2) > i've hacked this problem (see attached diff) but there're other problems like: I don't think it's a hack but simply an improvement - ccache has similar knowledge about other compiler options. I'll apply the patch, thanks!
Patch applied in dc2a53afb44cb083b64d3e6ef46a42d5ebabe4e0 on the master branch. I also clarified documentation on the behavior of --ccache-skip in 90ab944e3adc2cc864c8d2986c60eb7261963f18.
Documentation improvement included in v3.1.10.