mozilla / sccache

Sccache is a ccache-like tool. It is used as a compiler wrapper and avoids compilation when possible. Sccache has the capability to utilize caching in remote storage environments, including various cloud storage options, or alternatively, in local storage.
Apache License 2.0
5.85k stars 552 forks source link

preprocessor cache/direct mode doesn't produce -MF output #2194

Open glandium opened 5 months ago

glandium commented 5 months ago

STR:

touch foo.h
echo '#include "foo.h"' > foo.c
sccache gcc -o foo.o -c foo.c -MD -MF foo.pp

On the first run, sccache calls the preprocessor, which produces the foo.pp file, with contents:

foo.o: foo.c /usr/include/stdc-predef.h foo.h

Typically, this would be used by a build system to know when to rebuild foo.o. Without this file, the build system wouldn't know to rebuild foo.o when e.g. foo.h changes.

Now, clean your build directory and try again:

rm foo.o foo.pp
sccache gcc -o foo.o -c foo.c -MD -MF foo.pp

Now here's the problem: since the preprocessor wasn't called, and since the preprocessor cache doesn't store what would normally be in foo.pp, foo.pp is not created.

glandium commented 5 months ago

preprocessor cache doesn't store what would normally be in foo.pp

well, technically, it kind of does, in a different form, and it doesn't know how to recreate foo.pp from that.

glandium commented 5 months ago

2195 addresses this in the same way #2173 addressed #2122: by disabling preprocessor cache when it's broken.

This issue and #2122 will likely need common changes.

mbrodesser-Igalia commented 3 months ago

For contributors of Gecko without super-fast hardware it'd be nice if this could get fixed.