Gdb-8.2 compile error with master branch

I'm attempting to build OpenWrt for Raspberry Pi 3B+, with gdbserver included.
(I successfully built and ran it without gdbserver.)
In menuconfig, selected the correct SoC, added Luci, then followed https://openwrt.org/docs/guide-developer/gdb:
"Compiling Tools" - exactly as described.
"Add debugging to a package" - option "Global build settings > Compile packages with debugging info" (whether this is activated or not has no effect on the problem)

gdb compilation for the target fails:

Log

aarch64-openwrt-linux-musl-g++ -x c++ -Os -pipe -mcpu=cortex-a53 -fno-caller-saves -fno-plt -fhonour-copts -Wno-error=unused-but-set-variable -Wno-error=unused-result -iremap/mnt/1TB/ow/openwrt/build_dir/target-aarch64_cortex-a53_musl/gdb-8.2:gdb-8.2 -Wformat -Werror=format-security -fstack-protector -D_FORTIFY_SOURCE=1 -Wl,-z,now -Wl,-z,relro -I. -I. -I./common -I./config -DLOCALEDIR=""/usr/share/locale"" -DHAVE_CONFIG_H -I./../include/opcode -I./../opcodes/.. -I./../zlib -I../bfd -I./../bfd -I./../include -I../libdecnumber -I./../libdecnumber -I./gnulib/import -Ibuild-gnulib/import -DTUI=1 -Wall -Wpointer-arith -Wno-unused -Wunused-value -Wunused-function -Wno-switch -Wno-char-subscripts -Wempty-body -Wunused-but-set-parameter -Wunused-but-set-variable -Wno-sign-compare -Wno-narrowing -Wno-error=maybe-uninitialized -Wsuggest-override -Wimplicit-fallthrough=3 -Wduplicated-cond -Wformat-nonliteral -c -o aarch64-linux-nat.o -MT aarch64-linux-nat.o -MMD -MP -MF ./.deps/aarch64-linux-nat.Tpo aarch64-linux-nat.c
In file included from nat/aarch64-sve-linux-ptrace.h:23:0,
from aarch64-linux-nat.c:35:
/mnt/1TB/ow/openwrt/staging_dir/toolchain-aarch64_cortex-a53_gcc-7.4.0_musl/include/asm/sigcontext.h:26:8: error: redefinition of 'struct sigcontext'
struct sigcontext {
^~~~~~~~~~
In file included from /mnt/1TB/ow/openwrt/staging_dir/toolchain-aarch64_cortex-a53_gcc-7.4.0_musl/include/signal.h:48:0,
from build-gnulib/import/signal.h:52,
from linux-nat.h:23,
from aarch64-linux-nat.c:26:
/mnt/1TB/ow/openwrt/staging_dir/toolchain-aarch64_cortex-a53_gcc-7.4.0_musl/include/bits/signal.h:18:16: note: previous definition of 'struct sigcontext'
typedef struct sigcontext {
^~~~~~~~~~
In file included from nat/aarch64-sve-linux-ptrace.h:23:0,
from aarch64-linux-nat.c:35:
/mnt/1TB/ow/openwrt/staging_dir/toolchain-aarch64_cortex-a53_gcc-7.4.0_musl/include/asm/sigcontext.h:63:8: error: redefinition of 'struct _aarch64_ctx'
struct _aarch64_ctx {
^~~~~~~~~~~~
In file included from /mnt/1TB/ow/openwrt/staging_dir/toolchain-aarch64_cortex-a53_gcc-7.4.0_musl/include/signal.h:48:0,
from build-gnulib/import/signal.h:52,
from linux-nat.h:23,
from aarch64-linux-nat.c:26:
/mnt/1TB/ow/openwrt/staging_dir/toolchain-aarch64_cortex-a53_gcc-7.4.0_musl/include/bits/signal.h:29:8: note: previous definition of 'struct _aarch64_ctx'
struct _aarch64_ctx {
^~~~~~~~~~~~
In file included from nat/aarch64-sve-linux-ptrace.h:23:0,
from aarch64-linux-nat.c:35:
/mnt/1TB/ow/openwrt/staging_dir/toolchain-aarch64_cortex-a53_gcc-7.4.0_musl/include/asm/sigcontext.h:70:8: error: redefinition of 'struct fpsimd_context'
struct fpsimd_context {
^~~~~~~~~~~~~~
In file included from /mnt/1TB/ow/openwrt/staging_dir/toolchain-aarch64_cortex-a53_gcc-7.4.0_musl/include/signal.h:48:0,
from build-gnulib/import/signal.h:52,
from linux-nat.h:23,
from aarch64-linux-nat.c:26:
/mnt/1TB/ow/openwrt/staging_dir/toolchain-aarch64_cortex-a53_gcc-7.4.0_musl/include/bits/signal.h:33:8: note: previous definition of 'struct fpsimd_context'
struct fpsimd_context {
^~~~~~~~~~~~~~
In file included from nat/aarch64-sve-linux-ptrace.h:23:0,
from aarch64-linux-nat.c:35:
/mnt/1TB/ow/openwrt/staging_dir/toolchain-aarch64_cortex-a53_gcc-7.4.0_musl/include/asm/sigcontext.h:80:8: error: redefinition of 'struct esr_context'
struct esr_context {
^~~~~~~~~~~
In file included from /mnt/1TB/ow/openwrt/staging_dir/toolchain-aarch64_cortex-a53_gcc-7.4.0_musl/include/signal.h:48:0,
from build-gnulib/import/signal.h:52,
from linux-nat.h:23,
from aarch64-linux-nat.c:26:
/mnt/1TB/ow/openwrt/staging_dir/toolchain-aarch64_cortex-a53_gcc-7.4.0_musl/include/bits/signal.h:39:8: note: previous definition of 'struct esr_context'
struct esr_context {
^~~~~~~~~~~
In file included from nat/aarch64-sve-linux-ptrace.h:23:0,
from aarch64-linux-nat.c:35:
/mnt/1TB/ow/openwrt/staging_dir/toolchain-aarch64_cortex-a53_gcc-7.4.0_musl/include/asm/sigcontext.h:113:8: error: redefinition of 'struct extra_context'
struct extra_context {
^~~~~~~~~~~~~
In file included from /mnt/1TB/ow/openwrt/staging_dir/toolchain-aarch64_cortex-a53_gcc-7.4.0_musl/include/signal.h:48:0,
from build-gnulib/import/signal.h:52,
from linux-nat.h:23,
from aarch64-linux-nat.c:26:
/mnt/1TB/ow/openwrt/staging_dir/toolchain-aarch64_cortex-a53_gcc-7.4.0_musl/include/bits/signal.h:43:8: note: previous definition of 'struct extra_context'
struct extra_context {
^~~~~~~~~~~~~
aarch64-linux-nat.c: In function 'void store_sveregs_to_thread(regcache*)':
aarch64-linux-nat.c:419:59: error: invalid use of incomplete type 'struct store_sveregs_to_thread(regcache*)::user_sve_header'
iovec.iov_len = ((struct user_sve_header ) base.get ())->size;
^~
aarch64-linux-nat.c:419:28: note: forward declaration of 'struct store_sveregs_to_thread(regcache
)::user_sve_header'
iovec.iov_len = ((struct user_sve_header *) base.get ())->size;
^~~~~~~~~~~~~~~
Makefile:1622: recipe for target 'aarch64-linux-nat.o' failed

BTW, this builds at tag v18.06.1, but my Raspberry Pi 3B+ can't boot from the resulting image.

I reverted 2 last changes to the gdb package, to what it was at this commit:

commit 525b8f06501233414ad6e56fe1134ae82ab28fc2
Author: Rosen Penev rosenp@gmail.com
Date: Wed Jun 6 18:22:26 2018 -0700

gdb: Update to 8.1

Tested on Turris Omnia (mvebu).

Signed-off-by: Rosen Penev <rosenp@gmail.com>

using these commands:
cd package/devel
git checkout 525b8f06501 gdb

and the build succeeded.