Weird unconnected nodes using ninja -t graph...

574 views
Skip to first unread message

Malfettone, Kris

unread,
May 25, 2017, 1:11:07 PM5/25/17
to ninja-build (ninja-build@googlegroups.com)

First off thanks again for all the work you guys put into ninja.  It is an amazing tool.  I am currently using the “graph” tool to produce dependency graphs in dot.  It works great except for the fact that there are a large number of seemingly fake nodes in the graph that I can’t explain.  They seem to simply be hex values.  Below is a picture.  I was wondering if anyone knows what is going on here?  This is a ninja build generated from cmake.  Also, those values do not appear anywhere in rules.ninja, build.ninja, or the output of “ninja –t targets all “either.  Any clue?  I am more concerned that I have some sort of rouge targets or dependencies in my builds that this is a warning off.

 

Thanking you in advance,

Kris






IMPORTANT: The information contained in this email and/or its attachments is confidential. If you are not the intended recipient, please notify the sender immediately by reply and immediately delete this message and all its attachments. Any review, use, reproduction, disclosure or dissemination of this message or any attachment by an unintended recipient is strictly prohibited. Neither this message nor any attachment is intended as or should be construed as an offer, solicitation or recommendation to buy or sell any security or other financial instrument. Neither the sender, his or her employer nor any of their respective affiliates makes any warranties as to the completeness or accuracy of any of the information contained herein or that this message or any of its attachments is free of viruses.

Evan Martin

unread,
May 25, 2017, 2:35:48 PM5/25/17
to Malfettone, Kris, ninja-build (ninja-build@googlegroups.com)
The data emitted by that is kind of a one-off I used for debugging some things.

The code is pretty simple and hasn't been touched in years:
It basically just traverses the ninja graph and emits all the data it encounters.

You might debug this by looking at the text of the generated .dot file to see why there are nodes without labels.

From the code, it looks like on line 54 we emit an edge between two pointers (written as hex into the .dot file), and rely on the code in line 28 to have emitted a name for those pointers.  So I guess these mystery nodes are accidentally not visited in the graph traversal.

It looks like this maybe only looks from the build targets to their inputs (the loop on line 65) and doesn't visit any additional outputs.  Maybe another loop that calls graph.AddTarget() for each output would be sufficient to get names for these, but that might also end up visiting parts of the build graph that you didn't request visiting.

--
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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Malfettone, Kris

unread,
May 25, 2017, 2:56:59 PM5/25/17
to Evan Martin, ninja-build (ninja-build@googlegroups.com)

Thank you for taking a look.  If I get a chance I will try and take a look to see if I can narrow it down further.  I did want to say that I found this tool super useful in getting my build dependencies / rules so even if it is just a one-off tool, I would love to see it stick around.

 

-Kris

--

To unsubscribe from this group and stop receiving emails from it, send an email to ninja-build...@googlegroups.com.


For more options, visit https://groups.google.com/d/optout.

Malfettone, Kris

unread,
May 31, 2017, 6:16:42 PM5/31/17
to Malfettone, Kris, Evan Martin, ninja-build (ninja-build@googlegroups.com)

I did finally figure this out.  The unresolved labels are my CMakeLists.txt files and a few files that are all dependencies of the build.ninja target.  The reason they are included in my graph are that some of the “few files” that are dependencies of the build.ninja target are also used as dependencies during the build.  For instance, I have a python module that both dynamically figures out “what to build” during configure time and dynamically code generates the source code during the build step.  So the fact that it was a dependency of my target is what brought it into my build graph.  Still not entirely sure why it adds the edges from dependencies to the phony node though.  If I add build.ninja to the target list of what to graph on the command line the labels do get set properly.  Or if I remove the dependency to build.ninja they do not appear in the graph at all.

 

Now that I know what they are I can both rest easy and either give them proper labels or exclude them in the graph output.  Thanks again for all the great work on ninja.

 

-Kris

Reply all
Reply to author
Forward
0 new messages