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

Simon Marchi
2020-10-13T14:26:52Z

On 2020-10-12 11:30 a.m., Andrew Burgess wrote:
> 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

The patch subject doesn't seem right.

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

I haven't tested, but I presume that you were able to reproduce the
problem and test the fix. If so, that LGTM.

Thanks!

Simon