Code coverage with ccache

Last edited on

Ccache is a compiler cache which accelerates the recompilation of a program.

Like coveragescanner, ccache is a compiler wrapper.

Using the two programs together is a configuration that is neither tested nor supported by Qt.io. We do not believe there will be much performance benefit from using ccache to cache instrumented code.

However, if you really want to use CoverageScanner with ccache, it is necessary to set the PATH variable as follows:

export PATH=/opt/SquishCoco/wrapper/bin:/opt/ccache/bin:$PATH

Create then (as root user) the ccache wrappers for g++ and gcc:

$ mkdir -p /opt/ccache/bin
$ ln -s /usr/bin/ccache /opt/ccache/bin/g++
$ ln -s /usr/bin/ccache /opt/ccache/bin/gcc

Which this configuration, calling gcc will:

  1. call CoverageScanner’s gcc wrapper,
  2. which calls ccache’s gcc wrapper,
  3. which finally calls the real gcc binary.