[CMake] Build failure due to {cd bindir} failed on Windows/Ninja

Jom O'Fisher jomofisher at gmail.com
Thu Dec 28 17:58:47 EST 2017


I have an issue that's really difficult to track down because it only seems
to repro on certain machines which don't have access to.

The sequence of events seems to be:
(1) Invoke cmake to generate ninja project. Success.
* Note that generated rules.ninja has .o compilation dependencies with
absolute paths and .so link dependencies with relative paths.
(2) Invoke "cmake --build my-path --target my-target"
(3) CMake changes tries to change it's working directory here:
https://github.com/Kitware/CMake/blob/08ce62bee5bee6805fbb01c1821c43
8028e858dc/Source/cmGlobalGenerator.cxx#L1811
(4) Evidence suggests this fails and is silently ignored here:
https://github.com/Kitware/CMake/blob/967ba2e18055943faabf6eec39703b
cad95a7551/Source/cmWorkingDirectory.cxx#L10
(5) CMake invokes ninja.exe to build.
(6) Ninja eventually tries to link the resulting .so and this fails because
the .so path is relative in rules.ninja and the output folder doesn't exist
relative to the current directory.

A common theme of the machines this repros on seems to be that they run a
non-US-English Windows. There has to be more to it though because I tried
that myself and still didn't repro. A theory I had was that CMakeCache.txt
is written in some encoding that loses information in the presence of
Unicode characters. I tried this and it didn't seem to pan out.

Mainly I'd like to see if anyone has ideas that would help me reproduce the
issue and also whether you suspect it may be fixed in versions of CMake
after 3.6.

My tracking bug which has the full history: https://issuetracker.
google.com/37131900

Thanks for your help
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://cmake.org/pipermail/cmake/attachments/20171228/1fcddec8/attachment.html>


More information about the CMake mailing list