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.in | |
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.in')
-rw-r--r-- | Makefile.in | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/Makefile.in b/Makefile.in index a1f64a2..589588d 100644 --- a/Makefile.in +++ b/Makefile.in @@ -67904,7 +67904,9 @@ all-gdb: maybe-all-opcodes all-gdb: maybe-all-libdecnumber all-gdb: maybe-all-libctf all-gdb: maybe-all-libbacktrace +configure-gdbserver: maybe-all-libiconv all-gdbserver: maybe-all-libiberty +all-gdbserver: maybe-all-libiconv configure-gdbsupport: maybe-configure-gettext all-gdbsupport: maybe-all-gettext configure-gprof: maybe-configure-gettext |