Re: [PATCH] gnulib: Ensure all libraries are used when building gdb/gdbserver

Andrew Burgess
2020-10-12T15:30:20Z

* Simon Marchi <simark@simark.ca> [2020-10-12 10:16:08 -0400]:

> On 2020-10-12 7:41 a.m., Joel Brobecker wrote:
> > I got reports of the nightly source packaging failing soon after
> > you pushed this patch, and I was able to reproduce it by configuring
> > (out of tree), followed by a "make distclean". I did a "make -C gdb install"
> > as well, but I don't think it should have any influence on the outcome.
> >
> > The error I get is the following:
> >
> > | Makefile:246: ../gnulib/Makefile.gnulib.inc: No such file or directory
> > | make[2]: *** No rule to make target '../gnulib/Makefile.gnulib.inc'. Stop.
> > | make[2]: Leaving directory '/[...]/gdb'
> >
> > Do you think you could look into it?
>
> Ah, that's a case I didn't think of. When make distclean runs, it runs
> first in gnulib, so erases gnulib/Makefile.gnulib.inc. When it then
> runs in gdb, the Makefile can't run.
>
> So I guess we'll need to make the inclusion condition/non-fatal for this
> reason, unless you see another way?

How about this?

I've added a module dependency to ensure that gdb/gdbserver are both
cleaned before gnulib. My hope is that this should ensure
Makefile.gnulib.inc still exists when needed...

Thanks,
Andrew

---

commit 75b86a705adbb127962beb5ef8d9d7181afe3789
Author: Andrew Burgess <andrew.burgess@embecosm.com>
Date: Mon Oct 12 16:04:32 2020 +0100

gdb/gdbserver: use '-include' to pull in Makefile.gnulib.inc

After commit:

commit 361cb219351d8b7e39e1962fe77f40aa80657b27
Date: Tue Oct 6 10:09:06 2020 +0100

gnulib: Ensure all libraries are used when building gdb/gdbserver

We now get an error when, at the top level of the build tree, we do
'make distclean'.

The reason for this is that the gnulib directory is cleaned before the
gdb directory, cleaning gnulib deletes Makefile.gnulib.inc from the
gnulib build directory, which is currently pulled in by the gdb
Makefile.in using 'include'.

This commit adds a dependency between distclean-gnulib and both
distclean-gdb and distclean-gdbserver. This means that gdb and
gdbserver will be cleaned before gnulib, as a result the
Makefile.gnulib.inc file should exist when needed.

ChangeLog:

* Makefile.in: Rebuild.
* Makefile.def: Make distclean-gnulib depend on distclean-gdb and
distclean-gdbserver.

diff --git a/Makefile.def b/Makefile.def
index 76d062bb671..089e70ae3ed 100644
--- a/Makefile.def
+++ b/Makefile.def
@@ -548,6 +548,12 @@ dependencies = { module=configure-libctf; on=all-intl; };
dependencies = { module=configure-libctf; on=all-zlib; };
dependencies = { module=configure-libctf; on=all-libiconv; };

+// The Makefiles in gdb and gdbserver pull in a file that configure
+// generates in the gnulib directory, so distclean gnulib only after
+// gdb and gdbserver.
+dependencies = { module=distclean-gnulib; on=distclean-gdb; };
+dependencies = { module=distclean-gnulib; on=distclean-gdbserver; };
+
// Warning, these are not well tested.
dependencies = { module=all-bison; on=all-intl; };
dependencies = { module=all-bison; on=all-build-texinfo; };
diff --git a/Makefile.in b/Makefile.in
index 9dfd39fae13..fe34132f9e5 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -52366,6 +52366,8 @@ configure-stage3-libctf: maybe-all-stage3-libiconv
configure-stage4-libctf: maybe-all-stage4-libiconv
configure-stageprofile-libctf: maybe-all-stageprofile-libiconv
configure-stagefeedback-libctf: maybe-all-stagefeedback-libiconv
+distclean-gnulib: maybe-distclean-gdb
+distclean-gnulib: maybe-distclean-gdbserver
all-bison: maybe-all-build-texinfo
all-flex: maybe-all-build-bison
all-flex: maybe-all-m4