[wg-windows] mingw, ocamlopt and "input line is too long"

Andreas Hauptmann andreashauptmann at t-online.de
Thu Jul 7 11:27:46 BST 2016

On Thu, 7 Jul 2016 09:18:09 +0200
Andre Maroneze wrote:
> ** Use cygpath: true
> ** Search path: .... (lots of directories, one per line)
> (lots of -I and -L, plus some extra flags, and this line is slightly 
> larger than 8k characters)
> La ligne de commande est trop longue.
> ** Fatal error: Error during linking
> So it's that call to i686-w64-mingw32-gcc that fails. Is there a way
> to use a response file for that command as well?

Ok, I think I've identified the problem. Flexlink already writes the
command to a file and execute this file with bash, if the command line
is too long. Since both bash and gcc are linked against cygwin-1.dll,
there aren't any limits beside your main memory (cygwin programs use
shared memory to pass command line arguments and environment variables
around, if they hit a limit imposed by windows).

However there are at least two problems:
- the decision to use bash or not is based on a gross estimation, not
the real command line length (It looks at your object files, not your
include directories)
- The wrong quote function is used to write the shell script
(Filename.quote quotes for cmd, not a unix shell,...)


as replacement for your current flexlink.exe. 

I’m not sure, if my guess (and patch) is correct. When I’ve tried to
use a opam switch under a location with long filenames, I fail much
earlier because of the filename length limit of 260 - not because of
flexlink. (If you want to use more than 260 chars, you have to use the
unicode api and always use absolute paths – of course no commonly used
build system can deal with such limitations.)

More information about the wg-windows mailing list