[cmake-developers] ninja bug on windows
Peter Collingbourne
peter at pcc.me.uk
Sat Mar 10 23:05:39 EST 2012
On Fri, Mar 09, 2012 at 02:10:45PM -0500, Bill Hoffman wrote:
> I am seeing that ninja always wants to relink the executables for me
> every time it is run. The output is this:
>
> $ ninja
> [1/9] Linking C static library
> Utilities\cmlibarchive\libarchive\cmlibarchive.lib
> [2/9] Linking CXX executable bin\cmake.exe
> [3/9] Linking CXX executable bin\cmw9xcom.exe
> [4/9] Linking CXX executable bin\cpack.exe
> [5/9] Linking CXX executable bin\ctest.exe
> [6/9] Linking CXX executable Tests\CMakeLib\CMakeLibTests.exe
> [7/9] Generating ../Docs/ctest.txt
> [8/9] Generating ../Docs/cpack.txt
> [9/9] Generating ../Docs/cmake.txt
>
> Looks like the problem is libarchive getting recreated each time.
This seems to be a problem with the response file support in the
Windows branch of Ninja. That branch of Ninja will always relink
any target (in this case cmlibarchive.lib) in the case where the
list of object files exceeds the command line length limit, because
it causes Ninja to use a response file with a different generated
name every time. You can see this for yourself by examining the
.ninja_log file which contains the commands invoked by Ninja:
40 351 0 Utilities\cmlibarchive\libarchive\cmlibarchive.lib cmd.exe /c cd. && C:\PROGRA~1\MICROS~1.0\VC\bin\link.exe /lib /nologo @C:\DOCUME~1\peter\LOCALS~1\Temp\nja390.tmp&& cd.
751 5448 0 Utilities\cmlibarchive\libarchive\cmlibarchive.lib cmd.exe /c cd. && C:\PROGRA~1\MICROS~1.0\VC\bin\link.exe /lib /nologo @C:\DOCUME~1\peter\LOCALS~1\Temp\njaC0F.tmp&& cd.
681 6900 0 Utilities\cmlibarchive\libarchive\cmlibarchive.lib cmd.exe /c cd. && C:\PROGRA~1\MICROS~1.0\VC\bin\link.exe /lib /nologo @C:\DOCUME~1\peter\LOCALS~1\Temp\nja4F81.tmp&& cd.
6169 16264 0 Utilities\cmlibarchive\libarchive\cmlibarchive.lib cmd.exe /c cd. && C:\PROGRA~1\MICROS~1.0\VC\bin\link.exe /lib /nologo @C:\DOCUME~1\peter\LOCALS~1\Temp\nja4F95.tmp&& cd.
50 2443 0 Utilities\cmlibarchive\libarchive\cmlibarchive.lib cmd.exe /c cd. && C:\PROGRA~1\MICROS~1.0\VC\bin\link.exe /lib /nologo @C:\DOCUME~1\peter\LOCALS~1\Temp\nja8.tmp&& cd.
51 361 0 Utilities\cmlibarchive\libarchive\cmlibarchive.lib cmd.exe /c cd. && C:\PROGRA~1\MICROS~1.0\VC\bin\link.exe /lib /nologo @C:\DOCUME~1\peter\LOCALS~1\Temp\nja11.tmp&& cd.
50 351 0 Utilities\cmlibarchive\libarchive\cmlibarchive.lib cmd.exe /c cd. && C:\PROGRA~1\MICROS~1.0\VC\bin\link.exe /lib /nologo @C:\DOCUME~1\peter\LOCALS~1\Temp\nja19.tmp&& cd.
40 381 0 Utilities\cmlibarchive\libarchive\cmlibarchive.lib cmd.exe /c cd. && C:\PROGRA~1\MICROS~1.0\VC\bin\link.exe /lib /nologo @C:\DOCUME~1\peter\LOCALS~1\Temp\nja21.tmp&& cd.
The Ninja master branch avoids this problem by using a fixed name per
target for response files. So I guess we will need to wait until we
move to master.
Thanks,
--
Peter
More information about the cmake-developers
mailing list