Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Leaving directory.....?

Tags:

makefile

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

like image 321
Renjith G Avatar asked May 26 '09 03:05

Renjith G


People also ask

How do I go back a directory in terminal?

The .. means “the parent directory” of your current directory, so you can use cd .. to go back (or up) one directory. cd ~ (the tilde). The ~ means the home directory, so this command will always change back to your home directory (the default directory in which the Terminal opens).


1 Answers

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".

like image 107
Eric Melski Avatar answered Oct 13 '22 01:10

Eric Melski