how can gnu make return 2 and not show any errors?

View: New views
5 Messages — Rating Filter:   Alert me  

how can gnu make return 2 and not show any errors?

by Mark Galeck (CW) :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Some parts of this message have been removed. Learn more about Nabble's security policy.

Hello,

 

How can it be – my gnu make is returning 2 but does not show any errors.  I am using –include directive, but I checked and indeed, if make ignores errors because of –include, then it returns 0, as it should. 

 

So what else could it be?  (I can’t send you a short example, I can’t find the short example that would do that, and the makefile I am working with is in excess of 10000 lines). 

 

Mark


_______________________________________________
Help-make mailing list
Help-make@...
http://lists.gnu.org/mailman/listinfo/help-make

Re: how can gnu make return 2 and not show any errors?

by Paul Smith-20 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Tue, 2009-10-20 at 09:43 -0700, Mark Galeck (CW) wrote:

> How can it be – my gnu make is returning 2 but does not show any
> errors.  I am using –include directive, but I checked and indeed, if
> make ignores errors because of –include, then it returns 0, as it
> should.
>
> So what else could it be?  (I can’t send you a short example, I can’t
> find the short example that would do that, and the makefile I am
> working with is in excess of 10000 lines).  

Are you sure there wasn't an error further up the build?

There are some bugs in 3.81 around error handling and "-include" but I'm
not sure if these exact symptoms would be involved.  Boris fixed them a
week or two ago.  I'm working on getting out a release candidate for
3.82, so if you wanted to try the GNU make currently in CVS and see if
that worked any better it would be interesting.




_______________________________________________
Help-make mailing list
Help-make@...
http://lists.gnu.org/mailman/listinfo/help-make

Re: how can gnu make return 2 and not show any errors?

by Mike Shal :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On 10/20/09, Paul Smith <psmith@...> wrote:

> On Tue, 2009-10-20 at 09:43 -0700, Mark Galeck (CW) wrote:
>
>  > How can it be – my gnu make is returning 2 but does not show any
>  > errors.  I am using –include directive, but I checked and indeed, if
>  > make ignores errors because of –include, then it returns 0, as it
>  > should.
>  >
>  > So what else could it be?  (I can’t send you a short example, I can’t
>  > find the short example that would do that, and the makefile I am
>  > working with is in excess of 10000 lines).
>
>
> Are you sure there wasn't an error further up the build?
>
>  There are some bugs in 3.81 around error handling and "-include" but I'm
>  not sure if these exact symptoms would be involved.  Boris fixed them a
>  week or two ago.  I'm working on getting out a release candidate for
>  3.82, so if you wanted to try the GNU make currently in CVS and see if
>  that worked any better it would be interesting.
>

I've seen a similar problem before. I don't know the exact
circumstances that cause it, but this small set of files seems to
reproduce it. You will want to create ok.d manually - the normal
behavior of gcc -MMD doesn't seem to put ok.d in the ok.d file.

$ cat Makefile
all: ok.o
        echo all done
-include ok.d
ok.o: ok.c
        echo compile ok.c
$ cat ok.c
$ cat ok.d
ok.o ok.d: ok.c ok.h

$ make
$ echo $?
2

What's weird is if you remove the "ok.d" part from the ok.d file, you
get an actual error message:

$ make
make: *** No rule to make target `ok.h', needed by `ok.o'.  Stop.
$ echo $?
2

Basically you have to have a dependency file that is dependent on a
missing file (here, ok.h). I don't know why the error text only shows
up in the one in not the other though. This is make-3.81

In any case, I don't think make will ever handle file deletions
correctly. If you remove files (or do an update from revision control
that removes files), you are better off rebuilding everything from
scratch.

-Mike


_______________________________________________
Help-make mailing list
Help-make@...
http://lists.gnu.org/mailman/listinfo/help-make

Re: how can gnu make return 2 and not show any errors?

by Paul Smith-20 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Tue, 2009-10-20 at 13:06 -0400, Mike Shal wrote:
> Basically you have to have a dependency file that is dependent on a
> missing file (here, ok.h). I don't know why the error text only shows
> up in the one in not the other though. This is make-3.81

I tried your example with 3.81 and did reproduce this behavior, then I
tried it with the latest CVS code and this problem no longer exists, so
it's been fixed and will be in the next release:

xx$ ../make
make: *** No rule to make target `ok.h', needed by `ok.o'.  Stop.
xx$ echo $?
2


Cheers!



_______________________________________________
Help-make mailing list
Help-make@...
http://lists.gnu.org/mailman/listinfo/help-make

Parent Message unknown RE: how can gnu make return 2 and not show any errors?

by Paul Smith-20 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

It's best to hold these discussions on the mailing list, not in private.
That way you get the benefit of others' experience rather than relying
only on one person.

On Tue, 2009-10-20 at 10:01 -0700, Mark Galeck (CW) wrote:
> Wait, am I sure there are no rules that make could try to build the
> missing makefiles under -include??  Hmm, could this be causing that -
> if the rules are there, and make tries them and they fail, with
> -include all of that should be ignored and return 0, am I right or
> wrong?

They will be ignored during the include, but later on when make wants to
build them again as part of the "normal" build it will realize that they
failed (but it won't print the message because it thinks someone else
did already) and exit with an error code.  At least that's the way I
remember this bug.

As noted on the list, this problem has already been fixed in the current
CVS.  There will be a candidate for the next release of GNU make out
within the week, I expect; if you like you can test that (or you can
build from CVS if you have the appropriate tools such as automake,
autoconf, etc. installed).



_______________________________________________
Help-make mailing list
Help-make@...
http://lists.gnu.org/mailman/listinfo/help-make