diff options
author | Simon Marchi <simon.marchi@efficios.com> | 2024-03-14 13:39:18 -0400 |
---|---|---|
committer | Simon Marchi <simon.marchi@polymtl.ca> | 2024-03-14 13:40:08 -0400 |
commit | da48217f315084097ef25226c0acab3bbd55ebd3 (patch) | |
tree | 22b9b0342f9b0923ec951b9cd9a238579c95e93c /Makefile.def | |
parent | 91e15dbaf9d05747fab0d33e5af7ae69c983398a (diff) | |
download | gdb-da48217f315084097ef25226c0acab3bbd55ebd3.zip gdb-da48217f315084097ef25226c0acab3bbd55ebd3.tar.gz gdb-da48217f315084097ef25226c0acab3bbd55ebd3.tar.bz2 |
gdbserver/linux: probe for libiconv in configure
Make gdbserver's build system locate libiconv when building for Linux.
Commit 07b3255c3bae ("Filter invalid encodings from Linux thread names")
make libiconv madantory for building gdbserver on Linux.
While trying to cross-compile gdb for xtensa-fsf-linux-uclibc (with a
toolchain generated with crosstool-ng), I got:
/home/smarchi/src/binutils-gdb/gdbserver/linux-low.cc:48:10: fatal error: iconv.h: No such file or directory
48 | #include <iconv.h>
| ^~~~~~~~~
I downloaded GNU libiconv, built it for that host, and installed it in
an arbitrary directory. I had to modify the gdbserver build system to
locate libiconv and use it, the result is this patch.
I eventually found that crosstool-ng has a config option to make uclibc
provide an implementation of iconv, which is of course much easier. But
given that this patch is now written, I think it would be worth merging
it, it could help some people who do not have iconv built-in their libc
in the future (and may not have the luxury of rebuilding their libc like
I do).
Using AM_ICONV in configure.ac adds these options for configure (the
same we have for gdb):
--with-libiconv-prefix[=DIR] search for libiconv in DIR/include and DIR/lib
--without-libiconv-prefix don't search for libiconv in includedir and libdir
--with-libiconv-type=TYPE type of library to search for (auto/static/shared)
It sets the `LIBICONV` variable with whatever is needed to link with
libiconv, and adds the necessary `-I` flag to `CPPFLAGS`.
To avoid unnecessarily linking against libiconv on hosts that don't need
it, set `MAYBE_LIBICONV` with the contents of `LIBICONV` only if the
host is Linux, and use `MAYBE_LIBICONV` in `Makefile.in`.
Since libiconv is a hard requirement for Linux hosts, error out if it is
not found.
The bits in acinclude.m4 are similar to what we have in
gdb/acinclude.m4.
Update the top-level build system to support building against an in-tree
libiconv (I did not test this part though). Something tells me that the
all-gdbserver dependency on all-libiconv is unnecessary, since there is
already a dependency of configure-gdbserver on all-libiconv (and
all-gdbserver surely depends on configure-gdbserver). I just copied
what's done for GDB though.
ChangeLog:
* Makefile.def: Add configure-gdbserver and all-gdbserver
dependencies on all-libiconv.
* Makefile.in: Re-generate.
Change-Id: I90f8ef88dd4917df5a68b45550d93622fc9cfed4
Approved-By: Tom Tromey <tom@tromey.com>
Diffstat (limited to 'Makefile.def')
-rw-r--r-- | Makefile.def | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/Makefile.def b/Makefile.def index 3e00a72..6b143ab 100644 --- a/Makefile.def +++ b/Makefile.def @@ -461,9 +461,11 @@ dependencies = { module=all-gdb; on=all-libbacktrace; }; // Host modules specific to gdbserver. dependencies = { module=configure-gdbserver; on=all-gnulib; }; +dependencies = { module=configure-gdbserver; on=all-libiconv; }; dependencies = { module=all-gdbserver; on=all-gdbsupport; }; dependencies = { module=all-gdbserver; on=all-gnulib; }; dependencies = { module=all-gdbserver; on=all-libiberty; }; +dependencies = { module=all-gdbserver; on=all-libiconv; }; dependencies = { module=configure-libgui; on=configure-tcl; }; dependencies = { module=configure-libgui; on=configure-tk; }; |