Samurai fails to build https://github.com/bvschaik/julius
ibara opened this issue · comments
Hello --
On an OpenBSD/amd64 machine, samurai fails to build the repository at https://github.com/bvschaik/julius
Samurai prints the line
[1/2] /usr/local/bin/cmake -P /home/brian/julius/build/CMakeFiles/VerifyGlobs.cmake
100 times, then prints
samu: manifest 'build.ninja' dirty after 100 tries
In contrast, Ninja prints
[0/2] /usr/local/bin/cmake -P /home/brian/julius/build/CMakeFiles/VerifyGlobs.cmake
then proceeds to build the repository.
Let me know if you need anything else.
Thanks for reporting this issue. The best way to debug this sort of problem is to use -d explain
.
samu: explain /tmp/julius/build/CMakeFiles/VerifyGlobs.cmake_force: phony and no inputs
samu: explain /tmp/julius/build/CMakeFiles/cmake.verify_globs: input is dirty
samu: explain build.ninja: input is dirty
[1/2] /usr/bin/cmake -P /tmp/julius/build/CMakeFiles/VerifyGlobs.cmake
samu: explain /tmp/julius/build/CMakeFiles/VerifyGlobs.cmake_force: phony and no inputs
samu: explain /tmp/julius/build/CMakeFiles/cmake.verify_globs: input is dirty
samu: explain build.ninja: input is dirty
[1/2] /usr/bin/cmake -P /tmp/julius/build/CMakeFiles/VerifyGlobs.cmake
...
ninja explain: output /tmp/julius/build/CMakeFiles/VerifyGlobs.cmake_force of phony edge with no inputs doesn't exist
ninja explain: /tmp/julius/build/CMakeFiles/VerifyGlobs.cmake_force is dirty
ninja explain: /tmp/julius/build/CMakeFiles/cmake.verify_globs is dirty
[0/2] /usr/bin/cmake -P /tmp/julius/build/CMakeFiles/VerifyGlobs.cmake
ninja explain: deps for 'CMakeFiles/julius.dir/src/platform/arguments.c.o' are missing
ninja explain: CMakeFiles/julius.dir/src/platform/arguments.c.o is dirty
...
[1/500] /usr/bin/cc -I/usr/include/SDL2 -I../ext -I../src -Werror=incompatible-pointer-types -Werror=int-conversion -Wstrict-prototypes -Wall -Werror=implicit-function-declaration -std=gnu99 -MD
-MT CMakeFiles/julius.dir/src/core/calc.c.o -MF CMakeFiles/julius.dir/src/core/calc.c.o.d -o CMakeFiles/julius.dir/src/core/calc.c.o -c ../src/core/calc.c
Looking at the relevant parts of build.ninja, we have
#############################################
# Phony target to force glob verification run.
build /tmp/julius/build/CMakeFiles/VerifyGlobs.cmake_force: phony
#############################################
# Re-run CMake to check if globbed directories changed.
build /tmp/julius/build/CMakeFiles/cmake.verify_globs: VERIFY_GLOBS | /tmp/julius/build/CMakeFiles/VerifyGlobs.cmake_force
pool = console
restat = 1
#############################################
# Re-run CMake if any of its inputs changed.
build build.ninja: RERUN_CMAKE /tmp/julius/build/CMakeFiles/cmake.verify_globs | ...
So, what's happening here is that since CMakeFiles/VerifyGlobs.cmake_force
is built with the phony rule and no inputs, it is always out of date. That means that CMakeFiles/cmake.verify_globs
always needs to get rebuilt, which is an input to the command that builds build.ninja
. However, since CMakeFiles/cmake.verify_globs
has restat = 1
, and the VERIFY_GLOBS
command did not change the mtime of that file, the RERUN_CMAKE
command might get pruned.
Normally, if build.ninja
is out of date, we rebuild it, then reload the manifest. This case is slightly different in that build.ninja
is initially always out of date, but a restat rule might cause regeneration to be skipped, which samurai is not currently handling correctly. I believe this package exhibits the problem since it uses globs in CMakeLists.txt, so cmake has to use this trick to run a command to check if any of the globs changed before it can tell if build.ninja needs to be rebuilt.
I should have a fix for this shortly.