-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Description
I'm new to Meson+Ninja (ninja 1.8.2 on Ubuntu 18.10). As far as I understand, meson
corresponds roughly to autotools
and ninja
to make
. Please tell me if I'm wrong and this bugreport should be filed elsewhere.
This report is the same as the make
issue at http://savannah.gnu.org/bugs/?46242 (see http://lists.gnu.org/archive/html/bug-make/2015-10/msg00016.html for followup discussions, developer responses).
There's an inherent race condition in the way ninja
handles timestamps. If you save a newer version of a file while ninja
is running and is just compiling that input file, the change won't be picked up by subsequent runs of ninja
, and you'll be left with an out-of-date binary.
Steps to reproduce:
- Have some project.
- Open one of the large source files that takes noticeable time to compile.
- Edit this file in some valid way (changing the functionality) but do not save it yet.
- In a terminal, run
ninja
to compile your project. - While
ninja
is running, go back to your editor, but keep your eyes onninja
's output. - When
ninja
launches that particulargcc
(or whatever) that compiles this large file, save the new version. - Go back to the terminal.
ninja
might have completed by now. If not, you might either – if it has finished processing that file – interrupt it, or wait for it to complete. - Execute
ninja
again to catch up with the edits you performed. Wait for it to complete. - Launch your app, notice that it does not include your recent changes.
The behavior is obvious from the way ninja
checks the timestamps. The source of the file has an earlier timestamp than the compiled object file, since you saved the file before gcc
wrote out its output. But these are not corresponding versions.
Please see over there in the make
bugreport and mailing list discussion for further thoughts on this issue.