Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ccache with same code base and multiple toolchains

Tags:

gcc

icc

ccache

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.

like image 298
Ben Avatar asked Feb 24 '14 16:02

Ben


People also ask

Does CMake use ccache?

Getting ccache to work with CMake is not overly complicated, but the way to do it is not always obvious. This is especially true with Xcode builds. This article demonstrates how to set up a CMake project to use ccache with Unix Makefiles, Ninja or Xcode generators, with Xcode receiving special attention.

How do I clean up ccache?

Manual cleanup You can run ccache -c/--cleanup to force cleanup of the whole cache, i.e. all of the sixteen subdirectories. This will recalculate the statistics counters and make sure that the configuration options max_size and max_files are not exceeded.

How does ccache work?

Ccache is a compiler cache. It speeds up recompilation by caching the result of previous compilations and detecting when the same compilation is being done again. Ccache has been carefully written to always produce exactly the same compiler output that you would get without the cache.

How do I install ccache?

To install ccache with Homebrew, run brew install ccache . With MacPorts, run port install ccache . You can also download and install yourself, using the instructions in the repository. Make sure ccache can be found in your $PATH .


1 Answers

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)
like image 90
Mathiasdm Avatar answered Sep 30 '22 05:09

Mathiasdm