public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
* Unable to build GDB 13.1 on Solaris 11.3 Sparc
@ 2023-03-08 21:33 Nemo Nusquam
  2023-03-08 22:19 ` Rainer Orth
  2023-03-08 22:43 ` Andrew Pinski
  0 siblings, 2 replies; 7+ messages in thread
From: Nemo Nusquam @ 2023-03-08 21:33 UTC (permalink / raw)
  To: gdb

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' \
NM=/usr/bin/gnm \
SHELL=/usr/bin/bash \
AR=/usr/bin/gar \
AS=/usr/bin/as \
CC=/home/build/gcc/git/bin/gcc \
CXX=/home/build/gcc/git/bin/g++ \
../configure \
--with-mpc=/usr/local \
--with-gmp=/usr/local \
--with-mpfr=/usr/local \
--enable-64-bit-bfd \
--enable-tui \
--with-curses \
--disable-bootstrap \
--disable-binutils \
--disable-ld \
--disable-gprof \
--disable-gprofng \
--disable-gold \
--disable-gas \
--disable-sim

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

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'

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

I am stumped.  How do I proceed?

N.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Unable to build GDB 13.1 on Solaris 11.3 Sparc
  2023-03-08 21:33 Unable to build GDB 13.1 on Solaris 11.3 Sparc Nemo Nusquam
@ 2023-03-08 22:19 ` Rainer Orth
  2023-03-09  8:08   ` Andreas Schwab
  2023-03-09 18:45   ` Nemo Nusquam
  2023-03-08 22:43 ` Andrew Pinski
  1 sibling, 2 replies; 7+ messages in thread
From: Rainer Orth @ 2023-03-08 22:19 UTC (permalink / raw)
  To: Nemo Nusquam via Gdb; +Cc: Nemo Nusquam

Nemo Nusquam via Gdb <gdb@sourceware.org> 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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Unable to build GDB 13.1 on Solaris 11.3 Sparc
  2023-03-08 21:33 Unable to build GDB 13.1 on Solaris 11.3 Sparc Nemo Nusquam
  2023-03-08 22:19 ` Rainer Orth
@ 2023-03-08 22:43 ` Andrew Pinski
  2023-03-09 18:20   ` Nemo Nusquam
  1 sibling, 1 reply; 7+ messages in thread
From: Andrew Pinski @ 2023-03-08 22:43 UTC (permalink / raw)
  To: Nemo Nusquam; +Cc: gdb

On Wed, Mar 8, 2023 at 1:34 PM Nemo Nusquam via Gdb <gdb@sourceware.org> wrote:
>
> 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' \
> NM=/usr/bin/gnm \
> SHELL=/usr/bin/bash \
> AR=/usr/bin/gar \
> AS=/usr/bin/as \
> CC=/home/build/gcc/git/bin/gcc \
> CXX=/home/build/gcc/git/bin/g++ \
> ../configure \
> --with-mpc=/usr/local \
> --with-gmp=/usr/local \
> --with-mpfr=/usr/local \
> --enable-64-bit-bfd \
> --enable-tui \
> --with-curses \
> --disable-bootstrap \
> --disable-binutils \
> --disable-ld \
> --disable-gprof \
> --disable-gprofng \
> --disable-gold \
> --disable-gas \
> --disable-sim
>
> (Some flags taken from https://sourceware.org/gdb/wiki/BuildingNatively .)
>
> 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'

This was a known issue in GDB 13.1, It has been fixed/changed on the
trunk and will be included with GDB 14. For pre-GDB 14, the option you
want to use for configure is --with-libgmp-prefix= . libmpfr is
similar you need to use --with-libmpfr-prefix .
These options are documented in the installation documentation for GDB
13 but they were not part of the toplevel configure which is why they
were not mentioned there. The options --with-gmp= and --with--mpfr=
were only originally used for building GCC (GCC, GDB, binutils [and
newlib] all share the same toplevel configure/make file system) and
this was why folks got confused and even more I made the fix for this
to use these options also for GDB.

This issue was recorded as
https://sourceware.org/bugzilla/show_bug.cgi?id=28500 .

Thanks,
Andrew Pinski

>
> 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.)
>
> I am stumped.  How do I proceed?
>
> N.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Unable to build GDB 13.1 on Solaris 11.3 Sparc
  2023-03-08 22:19 ` Rainer Orth
@ 2023-03-09  8:08   ` Andreas Schwab
  2023-03-09 10:37     ` Rainer Orth
  2023-03-09 18:45   ` Nemo Nusquam
  1 sibling, 1 reply; 7+ messages in thread
From: Andreas Schwab @ 2023-03-09  8:08 UTC (permalink / raw)
  To: Rainer Orth; +Cc: Nemo Nusquam via Gdb, Nemo Nusquam

On Mär 08 2023, Rainer Orth wrote:

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

--disable-binutils does not disable building bfd (binutils is just
another consumer of bfd, like gdb), and will not do any harm.

-- 
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Unable to build GDB 13.1 on Solaris 11.3 Sparc
  2023-03-09  8:08   ` Andreas Schwab
@ 2023-03-09 10:37     ` Rainer Orth
  0 siblings, 0 replies; 7+ messages in thread
From: Rainer Orth @ 2023-03-09 10:37 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: Nemo Nusquam via Gdb, Nemo Nusquam

Andreas Schwab <schwab@suse.de> writes:

> On Mär 08 2023, Rainer Orth wrote:
>
>> 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.
>
> --disable-binutils does not disable building bfd (binutils is just
> another consumer of bfd, like gdb), and will not do any harm.

True, sorry for the confusion.  However, my point stands: none of those
--disable-* options are needed when building from a tarball, and keeping
configure lines as simple as possible unless proven otherwise has more
often than not proven to help things.

It's only when you build from a git checkout that they help reduce build
time, but still aren't strictly necessary.

	Rainer

-- 
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Unable to build GDB 13.1 on Solaris 11.3 Sparc
  2023-03-08 22:43 ` Andrew Pinski
@ 2023-03-09 18:20   ` Nemo Nusquam
  0 siblings, 0 replies; 7+ messages in thread
From: Nemo Nusquam @ 2023-03-09 18:20 UTC (permalink / raw)
  To: Andrew Pinski; +Cc: gdb

On 2023-03-08 17:43, Andrew Pinski wrote:
> On Wed, Mar 8, 2023 at 1:34 PM Nemo Nusquam via Gdb <gdb@sourceware.org> wrote:
>> 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' \
>> NM=/usr/bin/gnm \
>> SHELL=/usr/bin/bash \
>> AR=/usr/bin/gar \
>> AS=/usr/bin/as \
>> CC=/home/build/gcc/git/bin/gcc \
>> CXX=/home/build/gcc/git/bin/g++ \
>> ../configure \
>> --with-mpc=/usr/local \
>> --with-gmp=/usr/local \
>> --with-mpfr=/usr/local \
>> --enable-64-bit-bfd \
>> --enable-tui \
>> --with-curses \
>> --disable-bootstrap \
>> --disable-binutils \
>> --disable-ld \
>> --disable-gprof \
>> --disable-gprofng \
>> --disable-gold \
>> --disable-gas \
>> --disable-sim
>>
>> (Some flags taken from https://sourceware.org/gdb/wiki/BuildingNatively .)
>>
>> 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'
> This was a known issue in GDB 13.1, It has been fixed/changed on the
> trunk and will be included with GDB 14. For pre-GDB 14, the option you
> want to use for configure is --with-libgmp-prefix= . libmpfr is
> similar you need to use --with-libmpfr-prefix .
> These options are documented in the installation documentation for GDB
> 13 but they were not part of the toplevel configure which is why they
> were not mentioned there. The options --with-gmp= and --with--mpfr=
> were only originally used for building GCC (GCC, GDB, binutils [and
> newlib] all share the same toplevel configure/make file system) and
> this was why folks got confused and even more I made the fix for this
> to use these options also for GDB.

Thank you, Andrew.  I will try rebuilding as you suggest.

> This issue was recorded as
> https://sourceware.org/bugzilla/show_bug.cgi?id=28500 .
I tried searching but I erroneously assumed it was a Solaris problem and 
found nothing relevant.


> Thanks,
> Andrew Pinski

Thank you,
N.

[...]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Unable to build GDB 13.1 on Solaris 11.3 Sparc
  2023-03-08 22:19 ` Rainer Orth
  2023-03-09  8:08   ` Andreas Schwab
@ 2023-03-09 18:45   ` Nemo Nusquam
  1 sibling, 0 replies; 7+ messages in thread
From: Nemo Nusquam @ 2023-03-09 18:45 UTC (permalink / raw)
  To: Rainer Orth; +Cc: gdb

On 2023-03-08 17:19, Rainer Orth wrote (in part):
 > Nemo Nusquam via Gdb <gdb@sourceware.org> 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).

These options are those specified on the GDB Wiki 
(https://sourceware.org/gdb/wiki/BuildingNatively).

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

The gar options are different than the ar options.  Specifying AR
seems necessary.

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

Noted though I have built dozens of different versions of GCC this way.


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

Solaris 11.3 came bundled with gcc-4.8.2.  I relied on config.guess, 
which specifies sparc-sun-solaris2.11.  I shall try sparcv9-sun-solaris2.11.

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

Noted.

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

Again, the options were taken from the GDB Wiki.

 > Btw.,
 > --disable-binutils is harmful: gdb depends on libbfd and won't link
 > without, as you've discovered.

Again, the option was taken from the GDB Wiki.

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

Noted.


 > Hope this helps.
 >
 >     Rainer
 >

Thank you.

Sincerely,
N.

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2023-03-09 18:45 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-08 21:33 Unable to build GDB 13.1 on Solaris 11.3 Sparc Nemo Nusquam
2023-03-08 22:19 ` Rainer Orth
2023-03-09  8:08   ` Andreas Schwab
2023-03-09 10:37     ` Rainer Orth
2023-03-09 18:45   ` Nemo Nusquam
2023-03-08 22:43 ` Andrew Pinski
2023-03-09 18:20   ` Nemo Nusquam

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).