Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I am trying to compile a program written in Fortran using make (I have a Makefile and, while in the directory containing the Makefile, I type the command $ make target, where "target" is a system-specific target specification is present in my Makefile. As I experiment with various revisions of my target specification, I often get a variety of error messages when attempting to call make. To give a few examples:

make[1]: Entering directory
/bin/sh: line 0: test: too many arguments
./dpp   angfrc.f > angfrc.tmp.f
/bin/sh: ./dpp: Permission denied
make[1]: *** [angfrc.o] Error 126
make[1]: Leaving directory
make: *** [cmu60] Error 2

and

make[1]: Entering directory
/bin/sh: line 0: test: too many arguments
./dpp -DSTRESS -DMPI -P -D'pointer=integer'-I/opt/mpich_intel/include  angfrc.f > angfrc.tmp.f
/bin/sh: ./dpp: Permission denied
make[1]: *** [angfrc.o] Error 126
make[1]: Leaving directory 
make: *** [mpich-c2] Error 2

and

make[1]: Entering directory 
/bin/sh: line 0: test: too many arguments
./dpp -DSTRESS -DMPI -P -D'pointer=integer' -I/opt/mpich_intel/include  angfrc.f > angfrc.tmp.f
/bin/sh: ./dpp: Permission denied
make[1]: *** [angfrc.o] Error 126
make[1]: Leaving directory 
make: *** [mpi-intel] Error 2

Do you know how I can find a list of what the error codes, such as "Error 126" and "Error 2," mean? I found this thread on another website, but I am not sure what the reply means. Does it mean that there is no system-independent meaning of the make error codes? Can you please help me? Thank you.

share|improve this question
add comment

1 Answer

up vote 10 down vote accepted

The error codes aren't from make: make is reporting the return status of the command that failed. You need to look at the documentation of each command to know what each status value means. Most commands don't bother with distinctions other than 0 = success, anything else = failure.

In each of your examples, ./dpp cannot be executed. When this happens, the shell that tried to invoke it exits with status code 126 (this is standard behavior). The instance of make that was running that shell detects a failed command (the shell) and exits, showing you Error 126. That instance of make is itself a command executed by a parent instance of make, and the make utility returns 2 on error, so the parent make reports Error 2.

The failure of your build is likely to stem from test: too many arguments. This could be a syntax error in the makefile, or it could be due to relying on bash-specific features when you have a /bin/sh that isn't bash. Try running make SHELL=/bin/bash target or make SHELL=/bin/ksh target; if that doesn't work, you need to fix your makefile.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.