ninja files are regenerated infinitely or never if out directory is renamed |
|||
Issue descriptionThis is actually two related bugs. The first problem is that sometimes running "ninja -C out\Default" will cause the "Regenerating ninja files" step to be run infinitely. The second problem is that if you halt gn with Ctrl+C while it is generating .ninja files then it leaves the build directory in a bad state where subsequent builds will not generate the ninja files at all. Both bugs are triggered by the same root cause - renaming an output directory and not running "gn gen" on it. This is presumably not supported behavior, but the failure mode should be more elegant, especially since the Ctrl+C issue can be reproduce in other ways. Here is what the output looks like (Ctrl+C was typed during the third regenerating of ninja files): D:\src\chromium\src>ninja -C out\debug_analyze ninja: Entering directory `out\debug_analyze' [1/1] Regenerating ninja files [1/1] Regenerating ninja files [0/1] Regenerating ninja files ninja: error: rebuilding 'build.ninja': interrupted by user D:\src\chromium\src>ninja -C out\debug_analyze ninja: error: loading 'build.ninja': The system cannot find the file specified. ninja: Entering directory `out\debug_analyze' The initial issue is because build.ninja contains the path to the original output directory, the .ninja files are generated there, but the dependency checking expects them to be in the new (renamed) directory, which is why the infinite regenerating happens. The second issue is more general and therefore more important. If the "Regenerating ninja files" step is halted with Ctrl+C then the build.ninja file is often deleted and subsequent builds will fail. This can occur even without the unsupported directory renaming.
,
Oct 4 2016
,
Oct 4 2016
Checked in, still need to roll GN binary.
,
Oct 4 2016
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/eceed2e7c13045dcabfa07e7b7d7b4cd2807a0ec commit eceed2e7c13045dcabfa07e7b7d7b4cd2807a0ec Author: brettw <brettw@chromium.org> Date: Tue Oct 04 23:22:46 2016 GN: use the correct directory for self-invocation. GN writes a Ninja command to re-invoke GN when a build file changes. Previously this hardcoded the build directory. But if the user renames the build directory, Ninja will think the files are out of date but GN will keep regenerating files in another directory. This changes the directory to "." because Ninja will invoke all commands with the build directory as the current one. BUG= 639965 Review-Url: https://codereview.chromium.org/2389133003 Cr-Commit-Position: refs/heads/master@{#422995} [modify] https://crrev.com/eceed2e7c13045dcabfa07e7b7d7b4cd2807a0ec/tools/gn/ninja_build_writer.cc |
|||
►
Sign in to add a comment |
|||
Comment 1 by dpranke@chromium.org
, Aug 22 2016