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

Bug: Ninja CleanDead tool remove non-dead dynamic outputs #1952

Open
Dragnalith opened this issue Apr 15, 2021 · 1 comment
Open

Bug: Ninja CleanDead tool remove non-dead dynamic outputs #1952

Dragnalith opened this issue Apr 15, 2021 · 1 comment
Labels

Comments

@Dragnalith
Copy link

When running ninja -t cleandead, ninja will remove file which are dynamic outputs of the build (files registered in dyndep files as implicit outputs), but those dynamic outputs should not be considered dead. For instance in my example below, input1.o and input2.o are removed by ninja -t cleandead.

I have looked at CleanDead implementation and I have noticed it was never calling LoadDyndeps() during its initialization.


Below the experience I made the reproduce the issue:

rule my_tool_dyndep
    command = python my_tool.py --dyndep $out --output $output $in
rule my_tool
    command = python my_tool.py --output $out $in

build output.txt.dyndep : my_tool_dyndep list.txt
    output = output.txt
build output.txt : my_tool list.txt || output.txt.dyndep
    dyndep = build/test2/outputB.txt.dd

my_tool.py read list.txt, which contains a list of file to concatenate. The concatenation written in output.txt. To to experiment dynamic outputs, it also output one .o for every .txt contain in list.txt (in my example list.txt contains input1.txt input2.txt). When run with --dyndep the script only generate the dyndep corresponding to the expected action.

output.txt.dyndep

ninja_dyndep_version = 1
build output.txt | input1.o input2.o: dyndep | input1.txt input2.txt
@jhasse
Copy link
Collaborator

jhasse commented Apr 15, 2021

@jhasse jhasse added the bug label Apr 15, 2021
@jhasse jhasse mentioned this issue Aug 23, 2023
dcbaker added a commit to dcbaker/meson that referenced this issue Mar 28, 2024
There's a known ninja bug
(ninja-build/ninja#1952) that running this
with dyndeps will result in Ninja deleting implicit outputs from the
dyndeps, leading to pointless rebuilds. For reference, this is what
CMake does as well.
dcbaker added a commit to dcbaker/meson that referenced this issue Mar 29, 2024
There's a known ninja bug
(ninja-build/ninja#1952) that running this
with dyndeps will result in Ninja deleting implicit outputs from the
dyndeps, leading to pointless rebuilds. For reference, this is what
CMake does as well.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants