Re: GDB 17 build failure with musl

Chris Packham via Gdb <[email protected]> Wed, 4 Feb 2026 10:56:35 +1300
Newsgroups gmane.comp.gdb.devel
Message-ID <CAFOYHZCg+42xDjzE=7JpmCYYoOJOYK-BJBhwzxKJXG1ST9fLTQ@mail.gmail.com>
On Tue, Feb 3, 2026 at 4:10 PM Thiago Jung Bauermann
<[email protected]> wrote:
>
> Hello Chris,
>
> Chris Packham via Gdb <[email protected]> writes:
>
> > I've just updated crosstool-ng to include gdb 17.1 and the aarch64
> > musl toolchain fails with
> >
> > [ERROR]
> > /home/runner/work/crosstool-ng/crosstool-ng/.build/aarch64-unknown-linux-musl/src/gdb/gdbserver/../gdb/arch/aarch64-gcs-linux.h:35:8:
> > error: redefinition of 'struct user_gcs'
> > [ALL  ]       35 | struct user_gcs
> > [ALL  ]          |        ^~~~~~~~
> > [ALL  ]    In file included from
> > /home/runner/work/crosstool-ng/crosstool-ng/.build/aarch64-unknown-linux-musl/src/gdb/gdbserver/linux-aarch64-low.cc:35:
> > [ALL ]
> > /home/runner/work/crosstool-ng/crosstool-ng/x-tools/aarch64-unknown-linux-musl/aarch64-unknown-linux-musl/sysroot/usr/include/asm/ptrace.h:329:8:
> > note: previous definition of 'struct user_gcs'
> > [ALL  ]      329 | struct user_gcs {
> > [ALL  ]          |        ^~~~~~~~
> >
> > Does this ring any bells for anyone? Builds with gdb 16.3 are fine.
>
> Sorry for the delay in responding.

No problem.

> Do you have reproduction instructions for this problem? I'd like to
> experiment a bit and see if I can come up with a solution.

The only reproduction I have right now is to build crosstool-ng then
use ct-ng to build the aarch64-unknown-linux-musl sample. You'd need
to build from crosstool-ng commit be7fafbc7b6435 as I ended up
reverting the update for now to unblock some builds.

For the intrepid:

  git clone https://github.com/crosstool-ng/crosstool-ng.git
  cd crosstool-ng
  git checkout -B gdb-17-build  be7fafbc7b6435
  ./bootstrap && ./configure --enable-local && make
  ./ct-ng aarch64-unknown-linux-musl
  ./ct-ng build
  # go get a coffee this part can take a while

I have been meaning to come up with a better reproduction. At the very
least you could disable the gdb options in ./ct-ng menuconfig and use
the resulting toolchain & sysroot to build gdb rather than having to
sit through a full build to try something out (ct-ng does also have
various options for restarting a build from a particular step).

I actually suspect you could probably see the problem on a musl based
distro on an aarch64 host (or docker multiarch) but I haven't looked
into that.

>
> --
> Thiago