* GDB 17 build failure with musl
@ 2026-01-26 6:29 Chris Packham via Gdb
2026-01-26 6:55 ` Andrew Pinski via Gdb
2026-02-03 3:10 ` Thiago Jung Bauermann via Gdb
0 siblings, 2 replies; 7+ messages in thread
From: Chris Packham via Gdb @ 2026-01-26 6:29 UTC (permalink / raw)
To: GDB Mailing list
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.
Thanks,
Chris
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: GDB 17 build failure with musl
2026-01-26 6:29 GDB 17 build failure with musl Chris Packham via Gdb
@ 2026-01-26 6:55 ` Andrew Pinski via Gdb
2026-01-26 7:31 ` Chris Packham via Gdb
2026-02-03 3:10 ` Thiago Jung Bauermann via Gdb
1 sibling, 1 reply; 7+ messages in thread
From: Andrew Pinski via Gdb @ 2026-01-26 6:55 UTC (permalink / raw)
To: Chris Packham; +Cc: GDB Mailing list
On Sun, Jan 25, 2026 at 10:30 PM Chris Packham via Gdb
<gdb@sourceware.org> 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 .
Thanks,
Andrew Pinski
>
> Thanks,
> Chris
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: GDB 17 build failure with musl
2026-01-26 6:55 ` Andrew Pinski via Gdb
@ 2026-01-26 7:31 ` Chris Packham via Gdb
0 siblings, 0 replies; 7+ messages in thread
From: Chris Packham via Gdb @ 2026-01-26 7:31 UTC (permalink / raw)
To: Andrew Pinski; +Cc: GDB Mailing list
On Mon, Jan 26, 2026 at 7:55 PM Andrew Pinski <pinskia@gmail.com> wrote:
>
> On Sun, Jan 25, 2026 at 10:30 PM Chris Packham via Gdb
> <gdb@sourceware.org> 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
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: GDB 17 build failure with musl
2026-01-26 6:29 GDB 17 build failure with musl Chris Packham via Gdb
2026-01-26 6:55 ` Andrew Pinski via Gdb
@ 2026-02-03 3:10 ` Thiago Jung Bauermann via Gdb
2026-02-03 21:56 ` Chris Packham via Gdb
1 sibling, 1 reply; 7+ messages in thread
From: Thiago Jung Bauermann via Gdb @ 2026-02-03 3:10 UTC (permalink / raw)
To: Chris Packham; +Cc: gdb
Hello Chris,
Chris Packham via Gdb <gdb@sourceware.org> 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.
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.
--
Thiago
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: GDB 17 build failure with musl
2026-02-03 3:10 ` Thiago Jung Bauermann via Gdb
@ 2026-02-03 21:56 ` Chris Packham via Gdb
2026-02-04 4:11 ` Thiago Jung Bauermann via Gdb
0 siblings, 1 reply; 7+ messages in thread
From: Chris Packham via Gdb @ 2026-02-03 21:56 UTC (permalink / raw)
To: Thiago Jung Bauermann; +Cc: gdb
On Tue, Feb 3, 2026 at 4:10 PM Thiago Jung Bauermann
<thiago.bauermann@linaro.org> wrote:
>
> Hello Chris,
>
> Chris Packham via Gdb <gdb@sourceware.org> 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
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: GDB 17 build failure with musl
2026-02-03 21:56 ` Chris Packham via Gdb
@ 2026-02-04 4:11 ` Thiago Jung Bauermann via Gdb
2026-02-05 0:35 ` Chris Packham via Gdb
0 siblings, 1 reply; 7+ messages in thread
From: Thiago Jung Bauermann via Gdb @ 2026-02-04 4:11 UTC (permalink / raw)
To: Chris Packham; +Cc: gdb
Chris Packham <judge.packham@gmail.com> writes:
> On Tue, Feb 3, 2026 at 4:10 PM Thiago Jung Bauermann
> <thiago.bauermann@linaro.org> wrote:
>>
>> 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).
Thank you! This got me started. I suspect I'll have to add a configure
test for availability of struct user_gcs. I don't see any macro in
<asm/ptrace.h> itself which is correlated to the presence of that
struct. I'll let you know when I have a patch.
> 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.
Ah, that's true. I'll also test on Alpine Linux to make sure the patch
works there.
--
Thiago
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: GDB 17 build failure with musl
2026-02-04 4:11 ` Thiago Jung Bauermann via Gdb
@ 2026-02-05 0:35 ` Chris Packham via Gdb
0 siblings, 0 replies; 7+ messages in thread
From: Chris Packham via Gdb @ 2026-02-05 0:35 UTC (permalink / raw)
To: Thiago Jung Bauermann; +Cc: gdb
On Wed, Feb 4, 2026 at 5:11 PM Thiago Jung Bauermann
<thiago.bauermann@linaro.org> wrote:
>
> Chris Packham <judge.packham@gmail.com> writes:
>
> > On Tue, Feb 3, 2026 at 4:10 PM Thiago Jung Bauermann
> > <thiago.bauermann@linaro.org> wrote:
> >>
> >> 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).
>
> Thank you! This got me started. I suspect I'll have to add a configure
> test for availability of struct user_gcs. I don't see any macro in
> <asm/ptrace.h> itself which is correlated to the presence of that
> struct. I'll let you know when I have a patch.
>
I came to the same conclusion although I had a hard time getting the
configure result into a place that could actually use it. If it helps
here is the configure check I wrote
# Check for `struct user_gcs`
AC_CACHE_CHECK(
[for struct user_gcs],
[gdb_cv_struct_user_gcs],
[AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM(
[#include <sys/ptrace.h>
#include <asm/ptrace.h>],
[struct user_gcs u;]
)],
[gdb_cv_struct_user_gcs=yes],
[gdb_cv_struct_user_gcs=no]
)]
)
if test "$gdb_cv_struct_user_gcs" = yes; then
AC_DEFINE(HAVE_STRUCT_USER_GCS, 1,
[Define to 1 if your system has struct user_gcs.])
fi
>
> > 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.
>
> Ah, that's true. I'll also test on Alpine Linux to make sure the patch
> works there.
>
> --
> Thiago
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2026-02-05 0:36 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-01-26 6:29 GDB 17 build failure with musl Chris Packham via Gdb
2026-01-26 6:55 ` Andrew Pinski via Gdb
2026-01-26 7:31 ` Chris Packham via Gdb
2026-02-03 3:10 ` Thiago Jung Bauermann via Gdb
2026-02-03 21:56 ` Chris Packham via Gdb
2026-02-04 4:11 ` Thiago Jung Bauermann via Gdb
2026-02-05 0:35 ` Chris Packham via Gdb
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox