I discovered today that if using gcc with precompiled headers, using sccache fails but ccache works. It appears that sccache doesn’t properly handle the PCH artifacts, resulting in errors of the form:
cc1plus: error: /some/path/cmake_pch.hxx.gch: not a PCH file
even though that file does exist and was created by gcc, so it’s presumably a valid PCH file.
@ben.boeckel reported sccache not supporting PCH years ago in Does not support PCH compilation using `-include` · Issue #615 · mozilla/sccache · GitHub, which is still an open issue, but I don’t know if it is essentially the same lack of support, just a different manifestation of what I’m seeing. Anyone have any further details on this particular combination and whether it’s likely to be fixed any time soon? I was surprised by how little there seems to be online about it, given that it makes sccache a non-starter for any project using gcc with precompiled headers. For CMake projects, I’d expect that to be a common enough combination that we should be seeing more bug reports and discussions about it, so maybe I’m missing some important detail.