martine/ninja — Issue #147: Clearer error message for dependency analysis errors
Author: martine
Created: 2011-12-01 16:10:43+00:00
State: open

Elazar Leibovich wrote:

I stumbled upon bug in old gcc version, which emitted wrong .d dependency files. When given -MT newtarget, it would output "origtarget newtarget:...". This would obviously confuse ninja.

The problem is, ninja doesn't check the validity of the dependency files after they're created. So you compile the project from scratch, thinking that everything went great, alas, the second compilation phase fails with a cryptic error message "expected makefile to mention 'foo'..." if the file name emitted by gcc is wrong, or a parsing error in my case. The error message does not tell you which dependency file caused this error. Nor does it hint that it is a dependency file at all.

I therefor suggest, that

1. Dependencies will be verified after executing compilation rule. To catch errors as fast as possible.
2. Include extra information in error message (ie parsed foo.o.d since rule foo_cc include depfile. Could not however find output file mentioned in it.)

Sounds sound? (part 2 might have impact on performance, I'm not sure that it would be noticeable).