Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No dependencies when using ninja -t deps #2424

Open
amirbarak opened this issue Apr 17, 2024 · 4 comments
Open

No dependencies when using ninja -t deps #2424

amirbarak opened this issue Apr 17, 2024 · 4 comments

Comments

@amirbarak
Copy link

Heya. Using ninja 1.11.1 on Linux + cmake to manage a C project.

I'm trying to use ninja to map which headers are used by source files for a given target. I generate my build.ninja rules using cmake with the ninja multi-config generator, and while ninja -t inputs works given my targets, ninja -t deps outputs nothing - and if given a specific target, outputs test: deps not found.

My .ninja_deps file seems to be pretty big and populated, so I must be missing something basic. Is there any documentation specifically for the deps tool that could explain why I'm getting no output?

Thank you!

@digit-google
Copy link
Contributor

ninja -t deps <target> only prints the implicit dependencies recorded in the depfile generated the last time <target> was generated by Ninja. If the corresponding command in the Ninja build plan doesn't use a depfile, this will be empty. Which is what the deps not found seems to indicate.

Note: if your <target> is a phony target, it won't have a depfile ever, you must look at the real output target paths to get anything sensible.

Otherwise, you could try rebuilding ninja -d keepdepfile <target> to keep the depfile in the output directory, and look at its content to see whether it is empty or not.

@amirbarak
Copy link
Author

Thanks @digit-google . Is there a way to pass the keepdepfile through CMake or do I need to invoke ninja directly to "force" create the depfile?

@digit-google
Copy link
Contributor

As far as I know, you will need to invoke Ninja directly. I suggest asking in the CMake forums / mailing list otherwise.

@digit-google
Copy link
Contributor

digit-google commented Jun 25, 2024

Note that you can use ninja -t commands -s <target> to look at the command that generates <target>. It should be easy to see if it generates a depfile or not. This would be empty for phony target too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants