Bug 10215 - ccache hashes --ccache-skiped options?
Summary: ccache hashes --ccache-skiped options?
Status: CLOSED FIXED
Alias: None
Product: ccache
Classification: Unclassified
Component: ccache (show other bugs)
Version: 3.1.9
Hardware: x64 Linux
: P5 normal
Target Milestone: 3.1.10
Assignee: Joel Rosdahl
QA Contact: Joel Rosdahl
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-10-17 11:42 UTC by Pawel Sikora
Modified: 2014-10-19 18:38 UTC (History)
0 users

See Also:


Attachments
testcase (7.99 KB, application/octet-stream)
2013-10-17 11:42 UTC, Pawel Sikora
no flags Details
hack/workaround (656 bytes, patch)
2013-11-13 08:14 UTC, Pawel Sikora
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Pawel Sikora 2013-10-17 11:42:39 UTC
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
Comment 1 rseuster 2013-11-12 20:08:58 UTC
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.
Comment 2 Pawel Sikora 2013-11-13 08:14:04 UTC
(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
Comment 3 Pawel Sikora 2013-11-13 08:14:37 UTC
Created attachment 9412 [details]
hack/workaround
Comment 4 Joel Rosdahl 2014-01-08 19:25:40 UTC
--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.
Comment 5 Joel Rosdahl 2014-01-08 19:27:33 UTC
(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!
Comment 6 Joel Rosdahl 2014-04-09 18:53:40 UTC
Patch applied in dc2a53afb44cb083b64d3e6ef46a42d5ebabe4e0 on the master branch. I also clarified documentation on the behavior of --ccache-skip in 90ab944e3adc2cc864c8d2986c60eb7261963f18.
Comment 7 Joel Rosdahl 2014-10-19 18:38:28 UTC
Documentation improvement included in v3.1.10.