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

Simon Marchi
2020-10-06T14:10:30Z

On 2020-10-06 8:17 a.m., Andrew Burgess wrote:
> The problem here was me unconditionally trying to include
> Makefile.gnulib.inc from the gdb and gdbserver Makefile. The very
> first time you run 'make clean' after applying the patch
> Makefile.gnulib.inc doesn't exist, but the gdb/gdbserver makefiles
> still try to pull the file in unconditionally.

If the file is generated at configure-time, I think it would be ok for
Makefile.gnulib.inc to be included unconditionally. As when you run
"make clean" after pulling some changes, you're supposed to do to it
from the top level, so Makefile.gnulib.inc will be created before "make
clean" runs in GDB.

Building GDB (i.e. running "make" in gdb/) requires some other
directories (like gnulib/) to have been configured first. So if you
pull changes that affect these other directories and try to run "make"
just in gdb/ (instead of at the top-level), it's expected that some
things may not work (I think).

If there is no other legitimate situation where Makefile.gnulib.inc may
not exist, I'd slightly prefer for the include to be unconditional.
Simply because if Makefile.gnulib.inc doesn't exist, for some reason,
the error message will be much more straightforward. This:

$ make
/bin/sh config.status Makefile
config.status: creating Makefile
Makefile:242: ../gnulib/Makefile.gnulib: No such file or directory
make: *** No rule to make target '../gnulib/Makefile.gnulib'. Stop.

vs

$ make
CXX gdb.o
cc1plus: warning: command-line option ‘-Wmissing-prototypes’ is valid for C/ObjC but not for C++
In file included from /home/simark/src/binutils-gdb/gdb/defs.h:28,
from /home/simark/src/binutils-gdb/gdb/gdb.c:19:
/home/simark/src/binutils-gdb/gdb/../gdbsupport/common-defs.h:120:10: fatal error: pathmax.h: No such file or directory
120 | #include "pathmax.h"
| ^~~~~~~~~~~
compilation terminated.
make: *** [Makefile:1618: gdb.o] Error 1

Finally, I don't know if the change was intentional, but the file was
previously named Makefile.gnulib.inc and is now named Makefile.gnulib.
I liked Makefile.gnulib.inc, as it shows it's not a "top-level"
Makefile, it's meant to be included.

Otherwise, the patch LGTM, thanks!

Simon