[an error occurred while processing this directive] Node:Makefiles, Previous:How long, Up:Command line

16.6 Why Make passes only 126 characters to programs?

Q: I use Make to compile with GCC, but GCC gets only the first 126 characters of its command line. Didn't you just explain in so many words that invoking a DJGPP program (GCC) from another DJGPP program (Make) can safely pass up to 13K characters of command-line arguments using the !proxy method?

Q: I use RHIDE, but it only passes the first 126 characters of my long command lines to the compiler!

A: If you use Make 3.73, check your Makefile for SHELL = command.com statements, or for commands which include pipe or redirection characters like >, |, etc. If Make sees any such statements, it will invoke COMMAND.COM to run GCC, and COMMAND.COM can't pass more than 126 characters to GCC. To work around, comment-out the SHELL= line, and change your commands to work without redirection/pipe characters. One easy way to get rid of redirection characters without losing their effect is to use the redir program which comes with DJGPP. For example, the following command:

  frobnicate foo.bar > myfile.tmp

can be re-written instead like this:

  redir -o myfile.tmp frobnicate foo.bar

The ports of Make 3.75 and later don't call COMMAND.COM in the above cases, but rather emulate pipes and redirection internally, so upgrading to the latest version of Make will solve such problems. If you think about using Make 3.75 with DJGPP v2.0, don't: invoking v2.0 programs from v2.01 programs will cause subtle and hard-to-debug problems due to incompatibilities between these two versions regarding the methods of invoking child programs (in particular, v2.0 doesn't support the environment method of passing long command lines described above).

If you have problems with long command lines when using Make 3.75 and later, it might be caused by the environment variable SHELL that points to a Unix-style shell which is not a DJGPP program. This could happen, for example, if you use the shell from the MKS toolkit. When SHELL points to a program whose name looks like it's a Unix-style shell (sh.exe, bash.exe, etc.), library functions like system will invoke the shell to do everything, instead of using the internal shell emulator. If that shell isn't a DJGPP program, the long command lines will end up truncated. To solve these problems, either unset SHELL or override it by setting MAKESHELL to point to COMMAND.COM or to the DJGPP port of Bash. This is further explained in the GNU Make manual (see SHELL and MAKESHELL).

Problems with passing long commands from RHIDE are usually caused by invoking old programs compiled with DJGPP v2.0. Upgrade to the latest binaries.


[an error occurred while processing this directive]