[cmake-developers] [CMake 0013366]: Ninja generator on windows does not take everything into account when checking the command line length limit

Mantis Bug Tracker mantis at public.kitware.com
Sun Jul 1 16:59:50 EDT 2012


The following issue has been SUBMITTED. 
====================================================================== 
http://www.cmake.org/Bug/view.php?id=13366 
====================================================================== 
Reported By:                Josh Faust
Assigned To:                
====================================================================== 
Project:                    CMake
Issue ID:                   13366
Category:                   CMake
Reproducibility:            always
Severity:                   major
Priority:                   normal
Status:                     new
====================================================================== 
Date Submitted:             2012-07-01 16:59 EDT
Last Modified:              2012-07-01 16:59 EDT
====================================================================== 
Summary:                    Ninja generator on windows does not take everything
into account when checking the command line length limit
Description: 
When generating the ninja build files, on windows cmake will check the command
line length and generate a response file if it's too long. It does this by
checking the args and the build line passed to the ninja rule. This does not
take into account, though, what the ninja rule actually expands to including any
variables passed such as link flags, full executable path, etc.

CMake sets the command line limit to 8000 characters on windows, though the
actual limit is 8192. I'm assuming it's set to 8000 because it's trying to
account for the lack of these flags, but this is not always enough. In rare
cases the build can still fail with a "The command line is too long." error. 

In my specific case, these extra flags account for ~500 characters, while cmake
only actually checks http://www.cmake.org/Bug/view.php?id=5058#c7700 characters
-- and added together they're above the 8192 limit. 

The quick fix seems to be changing the max command line to be shorter (say,
7000) in cmNinjaNormalTargetGenerator.cxx:483.

The real fix would be to retrieve the rule and expand all the variables in the
command, which I do not see an easy way of doing after a quick look through the
code.
====================================================================== 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2012-07-01 16:59 Josh Faust     New Issue                                    
======================================================================




More information about the cmake-developers mailing list