8192 characters command line limit

Windows has a limit of 8192 characters for command line arguments.

This causes my ld to fail here https://travis-ci.org/piepacker/fbneo/jobs/650323083

With this error message:

g++.exe: error: CreateProcess: No such file or directory

Any idea of a workaround that doesn’t imply modifying the Makefile?

First of all, are you sure the error is what you think it is? g++.exe: error: CreateProcess: No such file or directory suggests that instead, some other executable that g++.exe tries to invoke is missing.


Solving the 8192 Character Command Line Limit on Windows | MCU on Eclipse suggests using an MSYS-based toolchain (that post suggests some obscure one; you would probably be fine with MinGW). The UNIX emulation layer that those executables contain passes command line arguments via an inherited pipe when invoking another MSYS-based process.

Another options is to use a response file, a feature of GCC specifically present to overcome this limitation.

1 Like

I’ve tried the response file but I can’t generate it properly on windows because of the same limit:

The echo command fails because it’s too long.

Instead of:

    $(foreach OBJ,$(OBJS),$(shell echo "$(OBJ)">>$@))

try the file function introduced in GNU Make v4.0.

1 Like
Imprint