tags:

views:

281

answers:

2

Hi ,

When i am compiling my code with makefiles(I have 12 makefiles) there is an error telling "make.exe[1]: Leaving directory Error 2" whats the reason for this..? Also what is the "Error 2 or Error 1 " mean...?

Regards

Renjith G

A: 

Error 2, in unix systems means ENOENT. In english "No such file or directory". Your makefile referenced a file or directory that did not exist, and make was unable to recover from the error.

1800 INFORMATION
ok thanks...then wats "Error 1"?
Renjith G
Error 1 is EPERM: "Operation not permitted", meaning you don't have the right to perform whatever command you're trying to do.
John Feminella
thanks...top your info
Renjith G
@1800 INFORMATION: Sorry, errno 2 on Unix systems means ENOENT, but that has no relationship to "Error 2" printed in this context by make. When make prints "Error 2" here it simply means that there was an error in a recursive make invocation. You have to look at the previous error messages to see what the real problem was, in the submake.@John Feminella: "Error 1" just means that some command invoked by make exited with exit code 1, and again has nothing to do with Unix errno values and everything to do with the exit codes defined by the particular command that failed.
Eric Melski
A: 

When make prints "Error 2" in this context it just means that there was an error in a recursive make invocation. You have to look at the error messages preceeding that message to determine what the real problem was, in the submake. For example, given a Makefile like this:

all:
        $(MAKE) -f sub.mk

... and a sub.mk like this:

all:
        @exit 1

When I run GNU make, it prints the following:

gmake -f sub.mk
gmake[1]: Entering directory `/tmp/foo'
gmake[1]: *** [all] Error 1
gmake[1]: Leaving directory `/tmp/foo'
gmake: *** [all] Error 2

Error 2 tells me that there was an error of some sort in the submake. I have to look above that message, to the Error 1 message from the submake itself. There I can see that some command invoked while trying to build all exited with exit code 1. Unfortunately there's not really a standard that defines exit codes for applications, beyond the trivial "exit code 0 means OK". You have to look at the particular command that failed and check its documentation to determine what the specific exit code means.

These error messages have nothing to do with Unix errno values as others have stated. The outermost "2" is just the error code that make itself assigns when a submake has an error; the inner "1" is just the exit code of a failed command. It could just as easily be "7" or "11" or "42".

Eric Melski