Re: GDB 17 build failure with musl

Chris Packham via Gdb <[email protected]> Mon, 26 Jan 2026 20:31:00 +1300
Newsgroups gmane.comp.gdb.devel
Message-ID <CAFOYHZDDkuaqCtUGY5Q7rBt5qbMK_Kvf2UsajzJAqZ-kVkDzug@mail.gmail.com>
On Mon, Jan 26, 2026 at 7:55 PM Andrew Pinski <[email protected]> wrote:
>
> On Sun, Jan 25, 2026 at 10:30 PM Chris Packham via Gdb
> <[email protected]> wrote:
> >
> > Hi GDB,
> >
> > 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.
>
> So aarch64-gcs-linux.h checks to see if GCS_MAGIC is defined to see if
> user_gcs is needed to be declared.
>
> GCS_MAGIC is defined in asm/sigcontext.h while gcs_user is defined in
> asm/ptrace.h.
>
> Maybe the issue is asm/sigcontext.h is not being included (indirectly
> like it is on glibc).
> Try adding
> #include <asm/sigcontext.h>
> After the include of asm/ptrace.h in gdbserver/linux-aarch64-low.cc .
>

Unfortunately that has its own issues

[ERROR]    /home/ctng/x-tools/aarch64-unknown-linux-musl/aarch64-unknown-linux-musl/sysroot/usr/include/asm/sigcontext.h:28:8:
error: redefinition of 'struct sigcontext'
[ERROR]    /home/ctng/x-tools/aarch64-unknown-linux-musl/aarch64-unknown-linux-musl/sysroot/usr/include/asm/sigcontext.h:70:8:
error: redefinition of 'struct _aarch64_ctx'
[ERROR]    /home/ctng/x-tools/aarch64-unknown-linux-musl/aarch64-unknown-linux-musl/sysroot/usr/include/asm/sigcontext.h:77:8:
error: redefinition of 'struct fpsimd_context'
[ERROR]    /home/ctng/x-tools/aarch64-unknown-linux-musl/aarch64-unknown-linux-musl/sysroot/usr/include/asm/sigcontext.h:96:8:
error: redefinition of 'struct esr_context'
[ERROR]    /home/ctng/x-tools/aarch64-unknown-linux-musl/aarch64-unknown-linux-musl/sysroot/usr/include/asm/sigcontext.h:136:8:
error: redefinition of 'struct extra_context'
[ERROR]    /home/ctng/x-tools/aarch64-unknown-linux-musl/aarch64-unknown-linux-musl/sysroot/usr/include/asm/sigcontext.h:145:8:
error: redefinition of 'struct sve_context'


> Thanks,
> Andrew Pinski
>
>
> >
> > Thanks,
> > Chris