#168 CC command line length limit

closed-fixed
Curt Arnold
cpptasks (103)
5
2006-03-20
2006-01-11
No

Currently cpptasks has a restriction with respect to
the maximum command line length passed to the <cc>
task. This limit can be easily exceeded in big
projects which imply big amount of source files and
long pathnames. The error in such cases may look like:

c:\xxx\yyy\build.xml:145: Command line is over maximum
length without specifying source file
at
net.sf.antcontrib.cpptasks.compiler.CommandLineCompiler
.compile
(Lnet.sf.antcontrib.cpptasks.CCTask;Ljava.io.File;
[Ljava.lang.String;[Ljava.lang.String;
[Ljava.lang.String;ZLnet.sf.antcontrib.cpptasks.compile
r.CommandLineCompilerConfiguration;Lnet.sf.antcontrib.c
pptasks.compiler.ProgressMonitor;)V
(CommandLineCompiler.java:154)
at
net.sf.antcontrib.cpptasks.compiler.CommandLineCompiler
Configuration.compile
(Lnet.sf.antcontrib.cpptasks.CCTask;Ljava.io.File;
[Ljava.lang.String;ZLnet.sf.antcontrib.cpptasks.compile
r.ProgressMonitor;)V
(CommandLineCompilerConfiguration.java:132)
at net.sf.antcontrib.cpptasks.CCTask.execute()V
(CCTask.java:616)
at org.apache.tools.ant.UnknownElement.execute
()V(UnknownElement.java:275)
at org.apache.tools.ant.Task.perform()V
(Optimized Method)
at org.apache.tools.ant.Target.execute()V
(Target.java:341)
at org.apache.tools.ant.Target.performTasks()V
(Target.java:369)
at org.apache.tools.ant.Project.executeTarget
(Ljava.lang.String;)V(Project.java:1214)
at net.sf.antcontrib.logic.AntFetch.execute()V
(AntFetch.java:345)
at org.apache.tools.ant.UnknownElement.execute
()V(UnknownElement.java:275)
at org.apache.tools.ant.Task.perform()V
(Optimized Method)
at org.apache.tools.ant.Target.execute()V
(Target.java:341)
at org.apache.tools.ant.Target.performTasks()V
(Target.java:369)
at org.apache.tools.ant.Project.executeTarget
(Ljava.lang.String;)V(Project.java:1214)
at org.apache.tools.ant.taskdefs.Ant.execute()V
(Ant.java:386)
at org.apache.tools.ant.UnknownElement.execute
()V(UnknownElement.java:275)
at org.apache.tools.ant.Task.perform()V
(Task.java:364)
at org.apache.tools.ant.Target.execute()V
(Target.java:341)
at org.apache.tools.ant.Target.performTasks()V
(Target.java:369)
at org.apache.tools.ant.Project.executeTarget
(Ljava.lang.String;)V(Project.java:1214)
at org.apache.tools.ant.taskdefs.Ant.execute()V
(Ant.java:386)
at org.apache.tools.ant.taskdefs.SubAnt.execute
(Ljava.io.File;Ljava.io.File;)V(SubAnt.java:265)
at org.apache.tools.ant.taskdefs.SubAnt.execute
()V(SubAnt.java:195)
at org.apache.tools.ant.UnknownElement.execute
()V(UnknownElement.java:275)
at org.apache.tools.ant.Task.perform()V
(Task.java:364)
at
org.apache.tools.ant.taskdefs.Sequential.execute()V
(Sequential.java:64)
at net.sf.antcontrib.logic.IfTask.execute()V
(IfTask.java:197)
...

Obviously the limit can be easily increased by
changing the method getMaximumCommandLength() in
classes like:
net.sf.antcontrib.cpptasks.devstudio.DevStudioCCompiler
net.sf.antcontrib.cpptasks.intel.IntelWin32CCompiler
net.sf.antcontrib.cpptasks.intel.IntelWin64CCompiler
...

For example, value of 65535 worked fine for me.

Discussion

  • Curt Arnold
    Curt Arnold
    2006-03-18

    Logged In: YES
    user_id=27193

    The current value of 1024 is the currently documented limit
    for Microsoft C/C++ compiler
    (http://msdn2.microsoft.com/en-us/library/610ecb4h.aspx)
    with a comment that it may not remain the same under future
    releases of Windows. When that documentation was written
    future meant Win NT 4 or 2000, not Vista.

    http://blogs.msdn.com/oldnewthing/archive/2003/12/10/56028.aspx
    list the maximum command length for cmd.exe is 8192 and
    CreateProcess is 32767. I have been able to successfully
    run compiles with MSVC 6 on WinXP where the command line
    exceeded 8192. I do not have a test cast that would cause a
    command line greater than 32767, so I would not set it any
    higher. Setting to 32767 for now and seeing if anyone
    complains and will check Win2000 later.

     
  • Curt Arnold
    Curt Arnold
    2006-03-20

    • status: open --> closed-fixed
     
  • Logged In: YES
    user_id=1424596

    I think 32767 should be fine, thanks for resolving this.
    Will be looking forward for the next binary release.