Clayton Hughes
Clayton Hughes

Reputation: 1035

Make/Execvp Error in Cygwin:

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.

Upvotes: 0

Views: 1669

Answers (2)

reinierpost
reinierpost

Reputation: 8591

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

Upvotes: 1

Krzysztof Nowak
Krzysztof Nowak

Reputation:

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

Upvotes: 1

Related Questions