Ninja 1.10.0 on Windows keeps rebuilding due to a header wrongly considered as an output

59 views
Skip to first unread message

Stefano Bonicatti

unread,
Jul 24, 2020, 5:06:41 PM7/24/20
to ninja-build
Hello everyone, I've recently hit a strange issue that I'm having difficulty to debug.
I'm on Windows, using CMake 3.17.1 to generate the build system files for Ninja 1.10.0.

After a full successful build, if I rerun Ninja, it wants to rebuild part of the project.
I've used ninja -d explain to understand what was happening and almost at the start I noticed:
ninja explain: output <path to a header file> of phony edge with no inputs doesn't exist

Also later that same header file is marked as dirty and is the cause of all the rebuilds.
Now that header file is not generated, it's part of the source code that's being built.
I've checked in the CMake code first to find how that file could've been marked as an output but found nothing.
I also figured that if I did something in CMake that would've marked it as an output, it would've been marked as an output in the ninja files.
I couldn't find any trace of it though; I've also saved the output of ninja -t targets all to then process it to be able to pass each target to ninja -t query <target name>,
but even there I couldn't find it.

At this point I have no idea on how to debug this issue (would've been nice to be able to point ninja to the output file and be able to know which target is supposed to output it),
and I cannot share much information about this project because it's private.

Do you have any pointer on how I could go further debugging this issue?
Thanks!

Scott Graham

unread,
Jul 24, 2020, 5:12:24 PM7/24/20
to Stefano Bonicatti, ninja-build
(I find it's almost always the *very* first explain edge that's the problem, not one at almost the start.)

Dumb question though: does <path to a header file> exist, relativized to the build directory?

I'd probably try to create a standalone project you can share, otherwise it's going to be hard for anyone to help, and/or you might figure out what's going on by doing so.

--
You received this message because you are subscribed to the Google Groups "ninja-build" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ninja-build...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ninja-build/067d3190-aa7b-471d-88d5-a81c661ccc27o%40googlegroups.com.

Michael Jones

unread,
Jul 24, 2020, 5:57:42 PM7/24/20
to Stefano Bonicatti, ninja-build
The most effective thing you can possibly do to get this fixed is

1) Create a minimal reproduction. This means a ninjafile and associated project files, that have as much stuff from it as possible removed that still produces the behavior that you think is a bug. If you can produce the bug without a ninjafile generator involved (e.g. no CMakeLists.txt needed), that's ideal.
2) Open a ticket on github with your minimal reproduction

Stefano Bonicatti

unread,
Jul 24, 2020, 5:58:26 PM7/24/20
to ninja-build
Hello Scott, thanks for the attention!

I skipped the few first lines mentally because they refers to an all target of a couple of subfolders where in CMake there are targets which do not build anything, but those folders are unrelated.

Your question is not dumb at all! I realized later that I should've clarified and, yes, the path shown is indeed correct and the header is present, relative to the root of the build folder.

The problem with creating a standalone project is that I have no idea whatsoever why that header is considered an output, so I wouldn't really know what to do to try to reproduce that issue.
I should also add that this wasn't always happening, so indeed some change in the CMake code made it happen, I can definitely bisect it, but it's something that would take
possibly several hours since it's a big project.

What I mainly wanted to know is if there was a way (different from what I tried already) to understand what is that phony target/edge that considers that header to be its output.

Scott Graham

unread,
Jul 24, 2020, 6:08:09 PM7/24/20
to Stefano Bonicatti, ninja-build
I'm not sure what might be happening, sorry.

I'd try looking through the .ninja file to see where there's a "phony your-header", or otherwise bisecting over CMake seems like it might be the best option since it sounds like it should be conclusive in a fixed amount of time.

--
You received this message because you are subscribed to the Google Groups "ninja-build" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ninja-build...@googlegroups.com.

Stefano Bonicatti

unread,
Jul 25, 2020, 7:46:05 PM7/25/20
to ninja-build
The tricky part is that I cannot find a reference to that header anywhere; I've already checked the ninja files, unfortunately.

So it seems I'm left with bisecting then, thanks for the help!
To unsubscribe from this group and stop receiving emails from it, send an email to ninja...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages