I have tried to compile GDB 11.1. Libgmp is not found even I specified path to it. Error: configure: error: GMP is missing or unusable Configured with: ../../src/gdb-11.1/configure --prefix=/home/mapniv/prog/riscv64-gdb --target=riscv64-none-elf --with-gmp-include=/home/mapniv/prog/gmp/include --with-gmp-lib=/home/mapniv/prog/gmp/lib --with-mpc=/home/mapniv/prog/mpc --with-mpfr=/home/mapniv/prog/mpfr
It is most likely related to https://sourceware.org/bugzilla/show_bug.cgi?id=28332
Are your symptoms the same as the ones in bug 28332? If so I guess we can close as a dup. Otherwise, we can investigate more. Maybe the contents of gdb/config.log would be interesting.
I'm sorry to answer this late. I thought no one would answer to this bug request. No, they are not. I was able to build GDB with GMP installed to standard location, but was unable to build it with GMP installed to custom location. That is options '--with-gmp', '--with-gmp-lib' and '--with-gmp-include' do not work.
Created attachment 14006 [details] gdb/config.log Attached gdb/config.log.
Above attachment was generated when building GDB 11.2 and not 11.1.
Ok, I think there was a thread about this on gdb-patches last year. For some reason there are two different sets of GMP flags to configure, and gdb doesn't respect the top-level ones: prentzel. ./configure --help|grep gmp --with-gmp-dir=PATH this option has been REMOVED --with-gmp=PATH specify prefix directory for the installed GMP --with-gmp-include=PATH/include plus --with-gmp-lib=PATH/lib --with-gmp-include=PATH specify directory for installed GMP include files --with-gmp-lib=PATH specify directory for the installed GMP library prentzel. ./gdb/configure --help|grep gmp --with-libgmp-prefix[=DIR] search for libgmp in DIR/include and DIR/lib --without-libgmp-prefix don't search for libgmp in includedir and libdir --with-libgmp-type=TYPE type of library to search for (auto/static/shared) So, I suggest trying the ones that gdb/configure reports. Top-level configure will pass these down despite the fact that it doesn't know about them.
Found the thread, didn't read it yet: https://sourceware.org/pipermail/gdb-patches/2020-November/173301.html
*** Bug 28625 has been marked as a duplicate of this bug. ***
*** Bug 28332 has been marked as a duplicate of this bug. ***
*** Bug 27762 has been marked as a duplicate of this bug. ***
The bug may also be duplicated on gdb 12.1.
Bug still exists in gdb 12.1. > So, I suggest trying the ones that gdb/configure reports [i.e. --with-gmp-prefix=DIR]. This only works if includes and libraries can be found in DIR/include and DIR/lib which is not always the case. E.g. for multi-arch systems the library path may be in DIR/lib32 or DIR/lib64. It would be nice if the gdb/configure could support the settings passed from the top configure via --with-gmp-include/--with-gmp-lib options. (Same applies to libmpfr which can be specified with --with-mpfr-* configure options but are ignored in gdb/configure.)
This is really messy. Basically, the top-level configure has the --with-gmp* flags because we sync that configure script with gcc (which lives in another repo). But apart from GDB, nothing in binutils-gdb uses GMP. And when the time came for GDB to use GMP, it was decided for some reason to use the AC_LIB_HAVE_LINKFLAGS macro (I suppose because it was handy), which provides the --with-libgmp-prefix flags. So in the binutils-gdb repo, we have some --with-gmp* flags at the top-level which don't do anything, but that people use (understandably so), because that's what the top-level "./configure --help" tells them to use. And then we have the flags that gdb/configure uses that actually do something, but are not sufficient. I don't know how feasible it is, but I think at this point we should make GDB understand the --with-gmp* flags in addition to the --with-libgmp* flags.
I found building with GMP to be useful too. Especially when doing Canadian cross builds. Then you don't need to build GMP seperately for the target you can just use the one that is newly built. Especially when it comes to doing combined builds too (which I still do). I should figure out how to clean up my patches and submit them upstream for this.
The only issue with my current patch really is that MPC also becomes a dependency which might be ok.
Created attachment 14436 [details] Patch which uses the toplevel configure to find gmp/libmpfr I will submit this patch soon; tomorrow. It is based on the gdb 12.1 release but I don't think much has changed there yet. Note it does change to always require MPFR rather than having it as an optional feature (with a warning) unlike before. It is better than my previous version which I did because I ran into this issue with gdb 8.3 as it does not cause MPC to be required for gdb now. I also tested to make sure GMP and MPFR could build when in the source directory and be used just like it is for gcc too.
Created attachment 14437 [details] Patch against the trunk Will do the changelog tomorrow.
Submitted: https://sourceware.org/pipermail/gdb-patches/2022-November/193581.html
The master branch has been updated by Andrew Pinski <pinskia@sourceware.org>: https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=991180627851801f1999d1ebbc0e569a17e47c74 commit 991180627851801f1999d1ebbc0e569a17e47c74 Author: Andrew Pinski <apinski@marvell.com> Date: Tue Nov 8 07:57:18 2022 +0000 Use toplevel configure for GMP and MPFR for gdb This patch uses the toplevel configure parts for GMP/MPFR for gdb. The only thing is that gdb now requires MPFR for building. Before it was a recommended but not required library. Also this allows building of GMP and MPFR with the toplevel directory just like how it is done for GCC. We now error out in the toplevel configure of the version of GMP and MPFR that is wrong. OK after GDB 13 branches? Build gdb 3 ways: with GMP and MPFR in the toplevel (static library used at that point for both) With only MPFR in the toplevel (GMP distro library used and MPFR built from source) With neither GMP and MPFR in the toplevel (distro libraries used) Changes from v1: * Updated gdb/README and gdb/doc/gdb.texinfo. * Regenerated using unmodified autoconf-2.69 Thanks, Andrew Pinski ChangeLog: * Makefile.def: Add configure-gdb dependencies on all-gmp and all-mpfr. * configure.ac: Split out MPC checking from MPFR. Require GMP and MPFR if the gdb directory exist. * Makefile.in: Regenerate. * configure: Regenerate. gdb/ChangeLog: PR bug/28500 * configure.ac: Remove AC_LIB_HAVE_LINKFLAGS for gmp and mpfr. Use GMPLIBS and GMPINC which is provided by the toplevel configure. * Makefile.in (LIBGMP, LIBMPFR): Remove. (GMPLIBS, GMPINC): Add definition. (INTERNAL_CFLAGS_BASE): Add GMPINC. (CLIBS): Exchange LIBMPFR and LIBGMP for GMPLIBS. * target-float.c: Make the code conditional on HAVE_LIBMPFR unconditional. * top.c: Remove code checking HAVE_LIBMPFR. * configure: Regenerate. * config.in: Regenerate. * README: Update GMP/MPFR section of the config options. * doc/gdb.texinfo: Likewise. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=28500
Fixed for GDB 14.