What are practical reasons for using multiple cache directories or clearing cache altogether when using CCACHE?
Help description for Buildroot BR2_CCACHE configuration option says:
Note that Buildroot does not try to invalidate the cache contents when the compiler changes in an incompatible way. Therefore, if you make a change to the compiler version and/or configuration, you are responsible for purging the ccache cache by removing the $HOME/.buildroot-ccache directory.
If I understand correctly, different compiler builds are recognized by CCACHE and caching is done on per-compiler basis. So, what are those situations that description is referring to?
Also, some sources seem to suggest that cache should be cleared regularly. Others point out that cache is cleaned up automatically when it reaches the "max cache size" threshold.
Obviously, if cached data is corrupted, then you need to do something about it. Are there other reasons to clear the cache? Wouldn't it make sense to keep a single cache?
The major reason is because buildroot sets the CCACHE_COMPILERCHECK variable to 'none'. See ccache.mk in Buildroot.
Buildroot does this for good reason: everytime they would rebuild the same compiler version (let's say gcc 4.8.0), all the ccache results would be thrown out, even if they're still valid. Additionally, it's possible that another part of the toolchain would change. This would also impact the cached files, but it would not be detected by checking if the compiler version changes. In the future, it's possible that an extensive check that covers all necessary parts of the toolchain will be used. It doesn't seem like this is the case yet.
Obviously, this is not optimal: ideally, ccache results would be purged automatically when you change the compiler version from 4.8 to 4.9. Right now, you have to do so manually.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With