Bug 28332 - [11 regression] configure check for GMP is insufficient
Summary: [11 regression] configure check for GMP is insufficient
Status: RESOLVED DUPLICATE of bug 28500
Alias: None
Product: gdb
Classification: Unclassified
Component: build (show other bugs)
Version: 11.1
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
Depends on:
Reported: 2021-09-13 08:39 UTC by Rainer Orth
Modified: 2022-03-06 16:09 UTC (History)
1 user (show)

See Also:
Host: sparcv9-sun-solaris2.11, amd64-pc-solaris.2.11
Target: sparcv9-sun-solaris2.11, amd64-pc-solaris.2.11
Build: sparcv9-sun-solaris2.11, amd64-pc-solaris.2.11
Last reconfirmed:


Note You need to log in before you can comment on or make changes to this bug.
Description Rainer Orth 2021-09-13 08:39:32 UTC
gdb's configure check for GMP is insufficient to build gdb 11.1 on Solaris 11.3:

* The bundled gmp is too old (at least for gcc's requirements), and even if it
  were ok for gdb, gmp.h lives in /usr/include/gmp, thus the header isn't found.

* A self-compiled libgmp isn't found for a 64-bit build.  While the header lives
  in $prefix/include, the library lives in $prefix/lib/sparcv9 resp.
  $prefix/lib/amd64 for the 64-bit case.  Solaris being multilibbed, the 32-bit
  libraries live in .../lib, while the 64-bit libs live in .../lib/sparcv9 etc.

gdb's --with-gmp-prefix is not enough to describe this situation because it only
supports $prefix/include and $prefix/lib.  Neither the Solaris 11.3-native
/usr/include/gmp directory for the header no the non-default $prefix/lib/{sparcv9,amd64} can be described that way.

I tried configuring with LDFLAGS=-L$prefix/lib/sparcv9 so the library is found
at configure time, but this doesn't work because the link line is

gcc -o conftest -g -O2     -I/vol/gcc/include  -L/vol/gcc/lib/sparcv9 conftest.c -lncurses -lsocket -lnsl -lm  /vol/gcc/lib/libgmp.a

i.e. the static library is specified with a (wrong) full path.

gcc gets things right by providing --with-gmp=$dir for the default case, but
allowing to specify --with-gmp-include and --with-gmp-lib separately to allow
for specific situations.
Comment 1 Rainer Orth 2021-09-13 08:45:02 UTC
I also tried passing CPPFLAGS=-I/usr/include/gmp so the bundled gmp.h is found,
but that doesn't work either because that isn't used in the subdir configure
Comment 2 Tom Tromey 2022-03-06 16:05:26 UTC
There was a thread about unifying the two different flags approaches:

Comment 3 Tom Tromey 2022-03-06 16:09:14 UTC
I'm arbitrarily picking one bug as the canonical one.

*** This bug has been marked as a duplicate of bug 28500 ***