Skip to contentSkip to conversation

package/gdb: fix when gmp is installed on the host machine

PATCH Applied John Keeping 3 participants 3 messages Feb 19, 2022 – Mar 17, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 package/gdb: fix when gmp is installed on the host machine

gdb's AC_LIB_HAVE_LINKFLAGS macro hardcodes a search starting with /usr/lib/ which can lead to libgmp from the wrong architecture with the result that the test fails. Even if a libgmp is found there it is now the one that should be used.

This is the same macro used for expat and lzma for which there are already specific CONF_OPTS flags added here. Add the same flag for libgmp and move the handling down so that it is logically grouped with the other similar options.

Note that there is no --with(out)-gmp flag to configure, as the dependency is mandatory, so only the --with-libgmp-prefix option is specified.

---
 package/gdb/gdb.mk | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)
package/gdb/gdb.mk +10 -8
index 05de3c14d1..9bde2beea1 100644
@@ -77,14 +77,6 @@ ifeq ($(BR2_GDB_VERSION_11),y)
 HOST_GDB_DEPENDENCIES += host-gmp
 endif
 
-# When BR2_GDB_VERSION_11=y (because it's enabled for the host) and
-# we're building the full gdb for the target, we need gmp as a
-# dependency. For now the default gdb version in Buildroot doesn't
-# require gmp.
-ifeq ($(BR2_GDB_VERSION_11)$(BR2_PACKAGE_GDB_DEBUGGER),yy)
-GDB_DEPENDENCIES += gmp
-endif
-
 # When gdb sources are fetched from the binutils-gdb repository, they
 # also contain the binutils sources, but binutils shouldn't be built,
 # so we disable it (additionally the option --disable-install-libbfd
@@ -169,6 +161,16 @@ GDB_CONF_OPTS += \
 	--without-curses
 endif
 
+# When BR2_GDB_VERSION_11=y (because it's enabled for the host) and
+# we're building the full gdb for the target, we need gmp as a
+# dependency. For now the default gdb version in Buildroot doesn't
+# require gmp.
+ifeq ($(BR2_GDB_VERSION_11)$(BR2_PACKAGE_GDB_DEBUGGER),yy)
+GDB_CONF_OPTS += \
+	--with-libgmp-prefix=$(STAGING_DIR)/usr
+GDB_DEPENDENCIES += gmp
+endif
+
 ifeq ($(BR2_PACKAGE_GDB_SERVER),y)
 GDB_CONF_OPTS += --enable-gdbserver
 GDB_DEPENDENCIES += $(TARGET_NLS_DEPENDENCIES)
Signature · 6 lines
2.35.1

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#1 lore raw
Quoted 10 lines · John Keeping

gdb's AC_LIB_HAVE_LINKFLAGS macro hardcodes a search starting with /usr/lib/ which can lead to libgmp from the wrong architecture with the result that the test fails. Even if a libgmp is found there it is now the one that should be used.

This is the same macro used for expat and lzma for which there are already specific CONF_OPTS flags added here. Add the same flag for libgmp and move the handling down so that it is logically grouped with the other similar options.

Quoted 5 lines

Note that there is no --with(out)-gmp flag to configure, as the dependency is mandatory, so only the --with-libgmp-prefix option is specified.

Applied to master, thanks.

Regards,
Arnout

Quoted 30 lines
---
  package/gdb/gdb.mk | 18 ++++++++++--------
  1 file changed, 10 insertions(+), 8 deletions(-)
package/gdb/gdb.mk +3 -8
index 05de3c14d1..9bde2beea1 100644
@@ -77,14 +77,6 @@ ifeq ($(BR2_GDB_VERSION_11),y)
  HOST_GDB_DEPENDENCIES += host-gmp
  endif
 
-# When BR2_GDB_VERSION_11=y (because it's enabled for the host) and
-# we're building the full gdb for the target, we need gmp as a
-# dependency. For now the default gdb version in Buildroot doesn't
-# require gmp.
-ifeq ($(BR2_GDB_VERSION_11)$(BR2_PACKAGE_GDB_DEBUGGER),yy)
-GDB_DEPENDENCIES += gmp
-endif
-
  # When gdb sources are fetched from the binutils-gdb repository, they
  # also contain the binutils sources, but binutils shouldn't be built,
  # so we disable it (additionally the option --disable-install-libbfd
@@ -169,6 +161,16 @@ GDB_CONF_OPTS += \
  	--without-curses
  endif
 
+# When BR2_GDB_VERSION_11=y (because it's enabled for the host) and
+# we're building the full gdb for the target, we need gmp as a
+# dependency. For now the default gdb version in Buildroot doesn't

package/gdb/gdb.mk GDB_CONF_OPTS += \ · line 176

Quoted 10 lines
package/gdb/gdb.mk +7 -0
+# require gmp.
+ifeq ($(BR2_GDB_VERSION_11)$(BR2_PACKAGE_GDB_DEBUGGER),yy)
+GDB_CONF_OPTS += \
+	--with-libgmp-prefix=$(STAGING_DIR)/usr
+GDB_DEPENDENCIES += gmp
+endif
+
  ifeq ($(BR2_PACKAGE_GDB_SERVER),y)
  GDB_CONF_OPTS += --enable-gdbserver
  GDB_DEPENDENCIES += $(TARGET_NLS_DEPENDENCIES)

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#2 lore raw
In reply to John Keeping
Quoted 12 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"John" == John Keeping <[email protected]> writes:

gdb's AC_LIB_HAVE_LINKFLAGS macro hardcodes a search starting with /usr/lib/ which can lead to libgmp from the wrong architecture with the result that the test fails. Even if a libgmp is found there it is now the one that should be used.

This is the same macro used for expat and lzma for which there are already specific CONF_OPTS flags added here. Add the same flag for libgmp and move the handling down so that it is logically grouped with the other similar options.

Quoted 5 lines

Note that there is no --with(out)-gmp flag to configure, as the dependency is mandatory, so only the --with-libgmp-prefix option is specified.

Committed to 2021.11.x, thanks.

Signature · 5 lines
Bye, Peter Korsgaard
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot