View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0015395CMakeCMakepublic2015-02-09 14:572016-06-10 14:31
ReporterDaniel Richard G. 
Assigned ToKitware Robot 
PrioritynormalSeverityminorReproducibilityalways
StatusclosedResolutionmoved 
Platformx86OSMicrosoft WindowsOS Version
Product VersionCMake 3.1.2 
Target VersionFixed in Version 
Summary0015395: NMAKE circa MSVC6 + Unix Makefiles + big project = "fatal error U1054: cannot create inline file"
DescriptionI am building a large project using CMake 3.1.2 with the Visual Studio 6 toolchain. As the IDE has not proven stable for automated building, I am using the Unix Makefiles generator with NMAKE+CL.

The project build consistently fails part-way through with an error of the form

    [ 35%] Building C object src/lib/CMakeFiles/foo.dir/bar/baz/baz_qux.c.obj
src\lib\CMakeFiles\foo.dir\build.make(66114) : fatal error U1054: cannot create inline file 'C:\tmp\nmz02696'
    Stop.
    NMAKE : fatal error U1077: '"C:\Program Files\Microsoft Visual Studio\VC98\BIN\NMAKE.EXE"' : return code '0x2'
    Stop.
    NMAKE : fatal error U1077: '"C:\Program Files\Microsoft Visual Studio\VC98\BIN\nmake.exe"' : return code '0x2'
    Stop.

Here's what I found in my investigation:

Each time the build rules use an NMAKE-generated response file with the @<< ... << syntax, NMAKE creates a temporary file in the $TMP directory. The temporary file name has the form nXXNNNNN, where X is a lowercase letter and N is a digit. The first temp file created is e.g. nma12345, then nmb12345, nmc12345. (The numerical part appears to be random, but is consistent for all temp files belonging to the same NMAKE instance. It does not appear to be a PID, but effectively serves the same purpose.)

After a while, it gets to nna12345, then nzz12345, it wraps back to naa12345, and then returns to nma12345. These files remain on the filesystem until the originating NMAKE process exits. So in theory, that is a maximum of 26*26 == 676 distinct temp file names that this version of NMAKE can use. Knowing that, the error above is obvious: NMAKE tried to write to an existing temp file that was still in use, and failed.

I am able to work around this problem by invoking the following bit of Perl on the CMake-generated build.make file:

    perl -pi.orig -e 'BEGIN{$i=0} s!(\@<<)(?=\r?\n)!"$1\$(TMP)\\nmake-".($i++).".tmp"!e' /path/to/CMakeFiles/myproject.dir/build.make

This assigns explicit temp-file names to the @<< ... << response files, using a naming scheme that does not top out at 676 entries. (It could still be improved, to allow multiple instances of NMAKE to run simultaneously.)

Visual Studio 6 may be old, but it's still an effective way to build code that links against the original MSVCRT.DLL. CMake would benefit from knowing its way around this limitation.
TagsNo tags attached.
Attached Files

 Relationships

  Notes
(0037950)
Brad King (manager)
2015-02-10 09:14

Interesting, thanks. NMake is still available with new VS tools so this may be useful for those versions too.

The code that records the @<< syntax is here:

 http://www.cmake.org/gitweb?p=cmake.git;a=blob;f=Modules/Platform/Windows.cmake;hb=v3.1.2#l31 [^]

Try grepping for use of CMAKE_START_TEMP_FILE in the other modules for where they appear in the rule variables. On the C++ side, all the rules go through the cmLocalGenerator::ExpandRuleVariables method:

 http://www.cmake.org/gitweb?p=cmake.git;a=blob;f=Source/cmLocalGenerator.cxx;hb=v3.1.2#l1158 [^]

Something around there could learn to substitute with a counter.

That should get you started teaching CMake about this approach.
(0042711)
Kitware Robot (administrator)
2016-06-10 14:29

Resolving issue as `moved`.

This issue tracker is no longer used. Further discussion of this issue may take place in the current CMake Issues page linked in the banner at the top of this page.

 Issue History
Date Modified Username Field Change
2015-02-09 14:57 Daniel Richard G. New Issue
2015-02-10 09:14 Brad King Note Added: 0037950
2016-06-10 14:29 Kitware Robot Note Added: 0042711
2016-06-10 14:29 Kitware Robot Status new => resolved
2016-06-10 14:29 Kitware Robot Resolution open => moved
2016-06-10 14:29 Kitware Robot Assigned To => Kitware Robot
2016-06-10 14:31 Kitware Robot Status resolved => closed


Copyright © 2000 - 2018 MantisBT Team