Leaving directory.....? - 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?

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

Related

How to have make fail on some warnings but not others

I have a make file that includes:
%.dat: %.txt
... PREPROCESSING OF TEXT FILE
tidy -o $*.html $<
... FURTHER PROCESSING
tidy produces lots of warnings that I can suppress with the flag --show-warnings false, but despite supressing the warnings, the exit status from tidy still 1 instead of 0, and so make fails part way through the recipe. How can I have make continue in the face of tidy giving exit status 1 while still allowing make to fail if any other recipe gives warnings?
I have looked at these two question (Have make fail if unit tests fail and gcc, make: how to disable fail on warning?) but neither seems to deal with this problem.
AFTER EDIT: In Make: how to continue after a command fails?, the question relates to how one gets make to continue after any non-zero exit status in executing a particular command, whereas in my case, I want an exit status of 2 from tidy indicating errors, to cause make to fail, but I want an exit status of 1 from tidy, indicating warningsto allowmake to continue`.
The simpliest solution:
tidy -o $*.html $< || true
So if tidy's exit code isn't zero the true produces zero exit code.
But check the tidy's exit codes:
Exit Status
0
All input files were processed successfully.
1
There were warnings.
2
There were errors.
Maybe you want skip only the error code 1. In this case:
tidy -o $*.html $< || [ $$? -eq 1 ] && true

Make threw out an error but no detailed error message

Here's the last few lines from the output of running "make install" at root level /home/gm/TEST/:
make[3]: Leaving directory `/home/gm/TEST/tppf/tm/ipmgt'
ld ipfac.o ipfacV.o ipfac_rset.o ipfac_args.o ipfac_d2a.o ipfac_a2d.o ipfac_modr.o ipfac_mod.o ipfac_read.o ipfac_add.o ipfac_del.o ipfac_list.o ipfac_unlk.o ipfac_lock.o ipfac_util.o ipfac_lkid.o -r -o /home/gm/TEST/tppf/lib/ipfac_tppf.o
make[3]: Leaving directory `/home/gm/TEST/tppf/tm/ipfac'
make[2]: Leaving directory `/home/gm/TEST/tppf/tm'
make[1]: *** [i_tm] Error 2
make[1]: Leaving directory `/home/gm/TEST/tppf'
make: *** [i_tppf] Error 2
And the Makefile under /home/gm/TEST/tppf/tm/ipfac contains this rule:
install: ipfac.h $(TPPLIB)/ipfac_tppf.o
$(TPPLIB)/ipfac_tppf.o: $(PROPOBJS)
ld $(PROPOBJS) -r -o $(TPPLIB)/ipfac_tppf.o
Is there something wrong with the linking process? Make should've told me what the error actually is, but it didn't.
BTW, I think /home/gm/TEST/tppf/lib/ipfac_tppf. O was linked and created successfully, or at least it was there in directory /home/gm/TEST/tppf/lib/ after make failed and exited.
That line is not the error line. You can tell that it succeeded because there was no error message there, for building the target /home/gm/TEST/tppf/lib/ipfac_tppf.o.
The error is here:
make[1]: *** [i_tm] Error 2
The [1] means that it was the first level of makefile (note the recipe you are quoting here was in the 3rd level of makefile) and the [i_tm] means that the build of the target i_tm failed. You need to look back up further in the output of make, earlier than what you've shown us, and find the *** error line for building the i_tm target and see what errors were generated there.

curl make error: "missing separator (did you mean TAB instead of 8 spaces?)"

I'm trying to build curl 7.38.0 on debian wheezy and keep getting this error after running ./configure.
$ make
Making all in lib
make[1]: Entering directory '/home/abc/curl-7.38.0/lib'
Makefile:2833: *** missing separator (did you mean TAB instead of 8 spaces?). Stop.
make[1]: Leaving directory '/home/abc/curl-7.38.0/lib'
Makefile:846: recipe for target 'all-recursive' failed
make: *** [all-recursive] Error 1
I tried looking at/around lines 2833 or 846 to see if there were excess spaces, but I didn't find any problems. Everything looks fine, so I don't understand why there would be any problems. Any help much appreciated!
I've encountered this error a few times before. The error message can be misleading a bit. What I found was that the timestamps of the files in the source directory were messed up for me, so I used touch to update them.
touch ./*
If that doesn't work, try updating all of the files except the Makefile.
for i in ./*; do [[ $i != ./Makefile ]] && touch $i; done
Then run make, and the config.status should recheck and proceed with compilation.

"make: *** [all] Error 1" for compiling tex files

I tried to write a makefile to compile the tex file, but an error made me crazy. I have simplified my makefile like below
all: main.tex
xelatex -interaction=nonstopmode ./main.tex
but the error still exists as follows.
make: *** [all] Error 1
I also tried to directly run the command in terminal:
xelatex -interaction=nonstopmode ./main.tex
I have a successful compilation. Similar errors have been found in make: *** [ ] Error 1 error and make: *** [ ] Error 1 error, but the solution does not work for me. Is there anyone could help me? Thanks.
A very dirty and useful trick is to force true in order to avoid the error and to let make continue:
$(FICTEX).pdf: $(FICTEX).aux $(BBL)
$(PDFLATEX) $(FICTEX)||true
$(PDFLATEX) $(FICTEX)||true

make error: "make[1]: *** [directories] Error 1"

When I try to run "make all" on a makefile with some complexity I get this errors:
C:\BITCLOUD\BitCloud_PS_SAM3S_EK_1_10_0\BitCloud_PS_SAM3S_EK_1_10_0\Applications\ZAppSi\Dem o\SEDevice>make all
make -C makefiles/PC -f Makefile_PC_Gcc all APP_NAME=DemoSE
make[1]: Entering directory
'C:/BITCLOUD/BitCloud_PS_SAM3S_EK_1_10_0/BitCloud_PS_SAM3S_EK_1_10_0/Applications/ZAppSi/Demo/SEDevice/makefiles/PC'
A sintaxe do comando está incorrecta.
make[1]: *** [directories] Error 1
make[1]: Leaving directory
'C:/BITCLOUD/BitCloud_PS_SAM3S_EK_1_10_0/BitCloud_PS_SAM3S_EK_1_10_0/Applications/ZAppSi/Demo/SEDevice/makefiles/PC'
make: *** [all] Error 2
where the line
A sintaxe do comando está incorrecta.
translated to english means: "The syntax of the command is incorrect"
I already tried to change the project to different directories, check spaces in file names, using GNU make and also use MinGW make (mingw32-make) and the result is the same with both "make". I also checked for all files that are included in the makefile and they correspond.
Im not an expert in makefiles, so Im asking for help.
What is the main problem that occurs when make throws this type of error?
It is likely not make that throws this error, but a command executed by make returns with a nonzero exit status, in this case with status 1 (due to Error 1); then the top level make stops with Error 2. Note that make by default stops as soon as a command fails.
Since the output doesn't show what command was executed, there is no way to tell what went wrong exactly.
EDIT: from the GNU make manual:
-d Print debugging information in addition to normal processing.
The debugging information says which files are being considered
for remaking, which file-times are being compared and with what
results, which files actually need to be remade, which implicit
rules are considered and which are applied---everything inter‐
esting about how make decides what to do.
--debug[=FLAGS]
Print debugging information in addition to normal processing.
If the FLAGS are omitted, then the behavior is the same as if -d
was specified. FLAGS may be a for all debugging output (same as
using -d), b for basic debugging, v for more verbose basic
debugging, i for showing implicit rules, j for details on invo‐
cation of commands, and m for debugging while remaking make‐
files.
I suggest running make --debug=j to see the commands.

Resources