incomplete rules.ninja files during `cmake --build` with QtCreator
i'm seeing the following error when running cmake --build
on macos 10.13:
15:44:22: Running steps for project XXX...
15:44:22: Starting: "/usr/local/bin/cmake" --build . --target XXX
[0/1 ?/sec] Re-running CMake...
[snip, all configuration goes well]
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/tim/build/xxx
ninja: error: rules.ninja:1527: unexpected EOF
description = Lin
^ near here
15:44:37: The process "/usr/local/bin/cmake" exited with code 1.
Error while building/deploying project XXX (kit: Unnamed-Clang (x86 64bit in /usr/bin))
The kit Unnamed-Clang (x86 64bit in /usr/bin) has configuration issues which might be the root cause for this problem.
When executing step "Make"
15:44:37: Elapsed time: 00:15.
if i understand it correctly cmake --build
thinks that the generated project is out of date and re-runs cmake, which generates rules.ninja
. then it runs ninja. however the files rules.ninja
has not been completely written to disk. after waiting for a few moments, the build succeds.
afaict this can happen when the files is written, but not fsync
ed to disk, yet. this causes ninja to read an incomplete rules.ninja
file. i'm not sure what's the correct way to handle this error. either the file descriptor of rules.ninja
would have to be fsync
ed, or the sync
command would have to be executed between invoking (re-running) cmake and ninja.