Re: Unable to build GDB 13.1 on Solaris 11.3 Sparc

Rainer Orth <[email protected]>
Newsgroups gmane.comp.gdb.devel
Message-ID <[email protected]>
Nemo Nusquam via Gdb <[email protected]> writes:

> I am trying (and failing) to build GDB 13.1 on Solaris 11.3 Sparc.
>
> Here is my configuration script.
>
> CXXFLAGS='-g3 -O0' \
> CFLAGS='-g3 -O0' \

Why?  Do you want/need to debug the resulting gdb itself?  Otherwise,
just leave the defaults (-g -O2).

> NM=/usr/bin/gnm \
> SHELL=/usr/bin/bash \

Probably rather CONFIG_SHELL.  Btw., it's often best to have
/usr/gnu/bin before /usr/bin in $PATH: configure scripts sometimes
assume the GNU tools and fail in weird ways with the native ones.

> AR=/usr/bin/gar \
> AS=/usr/bin/as \

Unnecessary for gdb.  Even when building gcc, use --with-as=/usr/bin/as
--without-gnu-as as documented in the installation guide.  Relying on
$PATH is risky and fragile.

> CC=/home/build/gcc/git/bin/gcc \
> CXX=/home/build/gcc/git/bin/g++ \

I suppose this is a 32-bit-default gcc (i.e. configured for
sparc-sun-solaris2.11, not sparcv9-sun-solaris2.11)?  Any reason not to
use the bundled gcc 7.3.0?  That one is 64-bit-default.

> ../configure \
> --with-mpc=/usr/local \
> --with-gmp=/usr/local \
> --with-mpfr=/usr/local \
> --enable-64-bit-bfd \
> --enable-tui \
> --with-curses \
> --disable-bootstrap \

This is gcc only, thus unnecessary for a gdb build.

> --disable-binutils \
> --disable-ld \
> --disable-gprof \
> --disable-gprofng \
> --disable-gold \
> --disable-gas \
> --disable-sim

If you're building from the gdb 13.1 tarball, you can omit those.  Btw.,
--disable-binutils is harmful: gdb depends on libbfd and won't link
without, as you've discovered.

> (Some flags taken from https://sourceware.org/gdb/wiki/BuildingNatively .)

In general, please start with the bare minimum of configure flags (like
the --with-* stuff).  Unless you known 200% what you're doing,
additional flags usually cause more harm then anything.

> The makefile creates ./gdb inside the build directory and then stops as
> follows:
>
> checking for libgmp... no
> configure: error: GMP is missing or unusable
> gmake[1]: *** [Makefile:11447: configure-gdb] Error 1
> gmake[1]: Leaving directory '/home/build/opt/gdb-13.1/bld'

You can find the exact errors in gdb/config.log.  Consulting that is
usually necessary to determine what exactly went wrong.

> I have libgmp (and building gcc 13 uses it) in /usr/local/lib:
>
> /usr/local/lib/libgmp.a:        current ar archive, 32-bit symbol table
> /usr/local/lib/libgmp.la:       commands text
> /usr/local/lib/libgmp.so:       ELF 64-bit MSB dynamic lib SPARCV9 Version
> 1, UltraSPARC3 Extensions Required, dynamically linked, not stripped, no
> debugging information available
> /usr/local/lib/libgmp.so.10:    ELF 64-bit MSB dynamic lib SPARCV9 Version
> 1, UltraSPARC3 Extensions Required, dynamically linked, not stripped, no
> debugging information available
> /usr/local/lib/libgmp.so.10.4.1:        ELF 64-bit MSB dynamic lib SPARCV9
> Version 1, UltraSPARC3 Extensions Required, dynamically linked, not
> stripped, no debugging information available
>
> Now I note that the Makefile is compiling to 32-bit objects but I have a
> 32-bit libgmp.a.  (I tried adding "-m64" but that caused other problems.)

Such as?  Please include the details so we can help.

> I am stumped.  How do I proceed?

Since your libgmp is 64-bit, you need to ensure a 64-bit build.  You can
achieve this either by using a 64-bit-default gcc/g++ or adding -m64 to
CC/CXX.  Adding it to CFLAGS/CXXFLAGS often doesn't work as expected,
unfortunately.

You should also add --build sparcv9-sun-solaris2.11 to the configure
flags.  config.guess has been badly messed with on Solaris in recent
times and misdetects the 64-bit triple.  I've given up fighting the
upstream chaos here and usually specify the correct triple explicitly.

Hope this helps.

	Rainer

-- 
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.