SonarCFamily and using a compiler cache(e.g. ccache)

we are running one of the lateste cfamily version 6.6 I think

I was wondering if i run Sonarscanner and i’m also using something like ccache.

will this interfere with the Sonarscanner scan, it should increase the build time in a big way?

Kind regards,
Edwyn

Hi @Ed_Die,

you are welcome to use ccache, it is going to speed-up your build and the analysis won’t be affected.

Hi,
from practical experience with this, it seems that the build wrapper does not recognize “ccache” as compiler. It only works if ccache, ultimately, has to call the compiler. Then the call will be recognized. If the result is cached already and the compiler is not invoked, SonarQube ignores the source file :frowning: Can this be fixed?

Hi, any updates on this?

Hello,

As Massimo stated, ccache is supported, even if the compiler is not invoked. It should work as long as the first parameter to ccache is a supported compiler.

If you are facing issues with it, please, do not hesitate to open a new thread describing what problems you are facing, the SonarQube version that you are using (if relevant), etc. so we may have a detailed look.

I can say with confidence that, unfortunately, it did not work for us and only actual compiler calls were considered (I checked the scanner logs). However, we have since (meaning 5 days ago :wink: stumbled upon the fact that SonarQube supports reading a JSON compilation database. This is a much better alternative for us, since it is easily generated by CMake and not prone to all problems that having to wrap stuff with the build wrapper is likely to have :grinning: So thanks for following up, but for us, I guess the case is closed now :v: