Using the -oq option: If you have two files of the same name in different directories like file.d and pkg/file.d, then there's a problem when pkg/file.d is recompiled and file.d isn't. pkg/file.d seems to be compiled to file.o and then renamed to pkg.file.o - resulting in the linker error
gcc: file.o: No such file or directory
It'd be fixed by compiling pkg/file.d to a file of a name that can't overlap with existing object files and then renaming it.
This happened to me with a homemade array.d and std.array (which is never actually compiled, but array.o is renamed to std.array.o in each run of rebuild anyway).