Build fails on missing depfile, but only on some machines
I have a rather difficult to follow issue that I've been unable to track down the cause of. It reproduces only on a couple of machines (both Ubuntu 18 LTS as far as I'm aware), but the same project on other Ubuntu 18 LTS machines doesn't exhibit the problem (same GCC, make
and ninja
versions too). It is 100% reproducible on the machines where it does occur. The error message from the compiler has the following form (sorry for the brevity, I can't share details about this particular project):
cc1: fatal error: CMakeFiles/somewhere.dir/src/main.c.d: No such file or directory
After various investigations, I have narrowed down the situation to the following:
- It only started with CMake 3.20, and it occurs with Ninja or Unix Makefiles as the generator.
- I can't reproduce it with CMake 3.19.8 with any generator.
- Setting
CMAKE_DEPENDS_USE_COMPILER
to false works around the problem for now. - The file being complained about isn't mentioned anywhere in the Makefile or Ninja project files. Instead of
main.c.d
, there's onlymain.c.o.d
. I haven't been able to find any trace of where themain.c.d
file name is coming from.
I don't have direct access to the problematic machines, but their owners are responsive and motivated to help work out the cause. If you have ideas for further things to try to track down the problem, I'd be very interested. I'd say this is a fairly clear regression, since it only started with CMake 3.20 for an otherwise working project.