tags:

views:

459

answers:

2

The following error occurs in make, while trying to do incremental builds:

make[2]: execvp: C:/path/to/compiler.exe: Message too long

I suspect my problem here is the argument length for execvp. Any idea what that limit is? How would one go about changing that?

Some curious extra information: the same command succeeds when previous make dependencies are in a folder with a shorter name. Is the amount of memory available to execvp dependent somehow affected by previous commands?

E.g. chopping 17 characters off the path to the incremental build files (of which there are hundreds) saves about 12k characters, and the 6k char command line to the compiler succeeds. Without reducing that path, the same command line fails.

+1  A: 

CreateProcess() from Windows has the following limitations:

1) pCommandLine [in, out, optional]

The command line to be executed. The maximum length of this string is 32,768 characters, including the Unicode terminating null character.

2) The ANSI version of this function, CreateProcessA fails if the total size of the environment block for the process exceeds 32,767 characters.

I had similar problem caused by limitation 2) but no good solution has been found. Probably recompiling cygwin with Unicode calls to CreateProcess() would help. For me it was sufficient to remove something from environment.

Krzysztof Nowak

It seems the workaround ("fix your command line to not be unreasonable") is the better option here. Thanks for the info!
Clayton Hughes
My workaround is a script that wraps the command and strips the environment variables: http://www.win.tue.nl/~rp/bin/wopath
reinierpost
A: 

I'm getting this error because my %PATH% (which is taken from $PATH) is too long.

reinierpost