diff mbox series

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

Message ID 20220219154350.1552021-1-john@metanate.com
State Accepted
Headers show
Series package/gdb: fix when gmp is installed on the host machine | expand

Commit Message

John Keeping Feb. 19, 2022, 3:43 p.m. UTC
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.

Signed-off-by: John Keeping <john@metanate.com>
---
 package/gdb/gdb.mk | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

Comments

Arnout Vandecappelle March 7, 2022, 9:46 p.m. UTC | #1
On 19/02/2022 16:43, John Keeping wrote:
> 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.
> 
> Signed-off-by: John Keeping <john@metanate.com>

  Applied to master, thanks.

  Regards,
  Arnout

> ---
>   package/gdb/gdb.mk | 18 ++++++++++--------
>   1 file changed, 10 insertions(+), 8 deletions(-)
> 
> diff --git a/package/gdb/gdb.mk b/package/gdb/gdb.mk
> index 05de3c14d1..9bde2beea1 100644
> --- a/package/gdb/gdb.mk
> +++ b/package/gdb/gdb.mk
> @@ -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)
Peter Korsgaard March 17, 2022, 12:18 p.m. UTC | #2
>>>>> "John" == John Keeping <john@metanate.com> 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.

 > 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.

 > Signed-off-by: John Keeping <john@metanate.com>

Committed to 2021.11.x, thanks.
diff mbox series

Patch

diff --git a/package/gdb/gdb.mk b/package/gdb/gdb.mk
index 05de3c14d1..9bde2beea1 100644
--- a/package/gdb/gdb.mk
+++ b/package/gdb/gdb.mk
@@ -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)