Skip to contentSkip to conversation

gdb: force to use ncurses and not termcap for host-gdb

PATCH New Thomas Petazzoni 3 participants 4 messages Jul 29, 2017 – Sep 4, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 gdb: force to use ncurses and not termcap for host-gdb

Both our target and host gdb depend on ncurses (host-ncurses for host-gdb, of course). However, while for the target we passs --with-curses, we are not doing this for the host variant. Due to this, host-gdb default to using the termcap library: if such a library is available on the build system, it will be used instead of the host-ncurses we have built. This causes the host gdb binary to depend on a library that we do not provide in $(HOST_DIR), breaking the principle of a standalone SDK (which should only depend on the C library).

To solve this, we simply pass --with-curses in HOST_GDB_CONF_OPTS, which forces host-gdb to use the host-ncurses library.

---
 package/gdb/gdb.mk | 1 +
 1 file changed, 1 insertion(+)
package/gdb/gdb.mk +1 -0
index 73b0ea0..1fef0d4 100644
@@ -203,6 +203,7 @@ HOST_GDB_CONF_OPTS = \
 	--enable-threads \
 	--disable-werror \
 	--without-included-gettext \
+	--with-curses \
 	$(GDB_DISABLE_BINUTILS_CONF_OPTS)
 
 ifeq ($(BR2_PACKAGE_HOST_GDB_TUI),y)
Signature · 1 line
2.9.4
#1 lore raw

PATCH 1/1 gdb: force to use ncurses and not termcap for host-gdb

Hi Thomas,

Le 29/07/2017 ? 22:06, Thomas Petazzoni a ?crit :

Quoted 10 lines

Both our target and host gdb depend on ncurses (host-ncurses for host-gdb, of course). However, while for the target we passs --with-curses, we are not doing this for the host variant. Due to this, host-gdb default to using the termcap library: if such a library is available on the build system, it will be used instead of the host-ncurses we have built. This causes the host gdb binary to depend on a library that we do not provide in $(HOST_DIR), breaking the principle of a standalone SDK (which should only depend on the C library).

Quoted 2 lines

To solve this, we simply pass --with-curses in HOST_GDB_CONF_OPTS, which forces host-gdb to use the host-ncurses library.

I did a test and indeed libtinfo.so.6 from the host is used without this patch.

ldd test/random/host/usr/bin/arm-linux-gdb

	linux-vdso.so.1 (0x00007ffc767f2000)
	libz.so.1 => /home/naourr/buildroot-test/test/random/host/lib/libz.so.1
(0x00007f590258c000)
	libdl.so.2 => /lib64/libdl.so.2 (0x00007f5902388000)
	*libtinfo.so.6 => /lib64/libtinfo.so.6 (0x00007f590215c000)*
	libm.so.6 => /lib64/libm.so.6 (0x00007f5901e53000)
	libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f5901c35000)
	libutil.so.1 => /lib64/libutil.so.1 (0x00007f5901a32000)
	libpython2.7.so.1.0 =>

/home/naourr/buildroot-test/test/random/host/lib/libpython2.7.so.1.0 (0x00007f5901618000)
libexpat.so.1 => /home/naourr/buildroot-test/test/random/host/lib/libexpat.so.1
(0x00007f59013ed000)

	liblzma.so.5 => /lib64/liblzma.so.5 (0x00007f59011c7000)
	libc.so.6 => /lib64/libc.so.6 (0x00007f5900e01000)
	/lib64/ld-linux-x86-64.so.2 (0x00007f59027a3000)

ldd test/random/host/usr/bin/arm-linux-gdb

	linux-vdso.so.1 (0x00007ffd69108000)
	libz.so.1 => /home/naourr/buildroot-test/test/random/host/lib/libz.so.1
(0x00007f10674e0000)
	libdl.so.2 => /lib64/libdl.so.2 (0x00007f10672dc000)
	*libncurses.so.6 =>
/home/naourr/buildroot-test/test/random/host/lib/libncurses.so.6
(0x00007f1067082000)*
	libm.so.6 => /lib64/libm.so.6 (0x00007f1066d79000)
	libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f1066b5b000)
	libutil.so.1 => /lib64/libutil.so.1 (0x00007f1066958000)
	libpython2.7.so.1.0 =>

/home/naourr/buildroot-test/test/random/host/lib/libpython2.7.so.1.0 (0x00007f106653e000)
libexpat.so.1 => /home/naourr/buildroot-test/test/random/host/lib/libexpat.so.1
(0x00007f1066313000)

	*liblzma.so.5 => /lib64/liblzma.so.5 (0x00007f10660ed000)*
	libc.so.6 => /lib64/libc.so.6 (0x00007f1065d27000)
	/lib64/ld-linux-x86-64.so.2 (0x00007f10676f7000)

But as you can see there is another library that can be provided by Buildroot liblzma.so.5.

If host-xz is build before host-gdb the result is slightly different :

ldd test/random/host/usr/bin/arm-linux-gdb

	linux-vdso.so.1 (0x00007ffebf9d8000)
	libz.so.1 => /home/naourr/buildroot-test/test/random/host/lib/libz.so.1
(0x00007f7347802000)
	libdl.so.2 => /lib64/libdl.so.2 (0x00007f73475fe000)
	libncurses.so.6 =>
/home/naourr/buildroot-test/test/random/host/lib/libncurses.so.6
(0x00007f73473a4000)
	libm.so.6 => /lib64/libm.so.6 (0x00007f734709b000)
	libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f7346e7d000)
	libutil.so.1 => /lib64/libutil.so.1 (0x00007f7346c7a000)
	libpython2.7.so.1.0 =>

/home/naourr/buildroot-test/test/random/host/lib/libpython2.7.so.1.0 (0x00007f7346860000)
libexpat.so.1 => /home/naourr/buildroot-test/test/random/host/lib/libexpat.so.1
(0x00007f7346635000)
*liblzma.so.5 => /home/naourr/buildroot-test/test/random/host/lib/liblzma.so.5
(0x00007f734640f000)*

	libc.so.6 => /lib64/libc.so.6 (0x00007f7346049000)
	/lib64/ld-linux-x86-64.so.2 (0x00007f7347a19000)

Otherwise:

Best regards,
Romain

Quoted 19 lines
---
 package/gdb/gdb.mk | 1 +
 1 file changed, 1 insertion(+)
package/gdb/gdb.mk +1 -0
index 73b0ea0..1fef0d4 100644
@@ -203,6 +203,7 @@ HOST_GDB_CONF_OPTS = \
 	--enable-threads \
 	--disable-werror \
 	--without-included-gettext \
+	--with-curses \
 	$(GDB_DISABLE_BINUTILS_CONF_OPTS)
 
 ifeq ($(BR2_PACKAGE_HOST_GDB_TUI),y)
author Applied
#2 lore raw

PATCH 1/1 gdb: force to use ncurses and not termcap for host-gdb

In reply to Thomas Petazzoni

Hello,

Quoted 10 lines · Thomas Petazzoni

Both our target and host gdb depend on ncurses (host-ncurses for host-gdb, of course). However, while for the target we passs --with-curses, we are not doing this for the host variant. Due to this, host-gdb default to using the termcap library: if such a library is available on the build system, it will be used instead of the host-ncurses we have built. This causes the host gdb binary to depend on a library that we do not provide in $(HOST_DIR), breaking the principle of a standalone SDK (which should only depend on the C library).

Quoted 7 lines

To solve this, we simply pass --with-curses in HOST_GDB_CONF_OPTS, which forces host-gdb to use the host-ncurses library.

---
 package/gdb/gdb.mk | 1 +
 1 file changed, 1 insertion(+)

Applied to master, thanks.

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
#3 lore raw

PATCH 1/1 gdb: force to use ncurses and not termcap for host-gdb

In reply to Thomas Petazzoni
Quoted 12 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Thomas" == Thomas Petazzoni <[email protected]> writes:

Both our target and host gdb depend on ncurses (host-ncurses for host-gdb, of course). However, while for the target we passs --with-curses, we are not doing this for the host variant. Due to this, host-gdb default to using the termcap library: if such a library is available on the build system, it will be used instead of the host-ncurses we have built. This causes the host gdb binary to depend on a library that we do not provide in $(HOST_DIR), breaking the principle of a standalone SDK (which should only depend on the C library).

Quoted 4 lines

To solve this, we simply pass --with-curses in HOST_GDB_CONF_OPTS, which forces host-gdb to use the host-ncurses library.

Committed to 2017.02.x, thanks.

Signature · 1 line
Bye, Peter Korsgaard