Search code examples
gcciccccache

ccache with same code base and multiple toolchains


Our system supports being built with three different toolchains (gcc, icc, diab). I am not sure if using ccache is safe in this case. My concern is the following: if I build with gcc, and then rebuild with diab, will I get a ccache hit in the case the files and their dependencies are the same ?

I do not want a hit in this case, since I want the files to be recompiled with diab.


Solution

  • You will not get a ccache hit between different compilers. The compiler is hashed. Additionally, you can change the environment variable CCACHE_COMPILERCHECK to check the compiler in a different way. As found in the ccache manual:

    For both modes, the following information is included in the hash:
    
        the extension used by the compiler for a file with preprocessor output (normally .i for C code and .ii for C++ code)
    
        the compiler’s size and modification time (or other compiler-specific information specified by CCACHE_COMPILERCHECK)
    
        the name of the compiler
    
        the current directory (if CCACHE_HASHDIR is set)
    
        contents of files specified by CCACHE_EXTRAFILES (if any)