在交叉编译 gdb 8.2 时发生结构重新定义

问题描述 投票:0回答:0

我想将 gdb 8.2 交叉编译到一个 arm64 设备中。 这是我要做的步骤:

  1. mkdir build && cd build.
  2. ../configure --host=aarch64-linux-gnu --target=aarch64-linux-gnu
  3. 制作 然后我从输出中得到了重新定义的错误和成员未定义。
/usr/include/x86_64-linux-gnu/asm/sigcontext.h:40:8: error: redefinition of ‘struct _fpx_sw_bytes’
   40 | struct _fpx_sw_bytes {
      |        ^~~~~~~~~~~~~
In file included from /usr/include/signal.h:291,
                 from build-gnulib/import/signal.h:52,
                 from ../../gdb/linux-nat.h:23,
                 from ../../gdb/aarch64-linux-nat.c:26:
/usr/include/x86_64-linux-gnu/bits/sigcontext.h:31:8: note: previous definition of ‘struct _fpx_sw_bytes’
   31 | struct _fpx_sw_bytes
      |        ^~~~~~~~~~~~~
In file included from ../../gdb/nat/aarch64-sve-linux-ptrace.h:23,
                 from ../../gdb/aarch64-linux-nat.c:35:
/usr/include/x86_64-linux-gnu/asm/sigcontext.h:85:8: error: redefinition of ‘struct _fpreg’
   85 | struct _fpreg {
      |        ^~~~~~
In file included from /usr/include/signal.h:291,
                 from build-gnulib/import/signal.h:52,
                 from ../../gdb/linux-nat.h:23,
                 from ../../gdb/aarch64-linux-nat.c:26:
/usr/include/x86_64-linux-gnu/bits/sigcontext.h:40:8: note: previous definition of ‘struct _fpreg’
   40 | struct _fpreg
      |        ^~~~~~
In file included from ../../gdb/nat/aarch64-sve-linux-ptrace.h:23,
                 from ../../gdb/aarch64-linux-nat.c:35:
/usr/include/x86_64-linux-gnu/asm/sigcontext.h:91:8: error: redefinition of ‘struct _fpxreg’
   91 | struct _fpxreg {
      |        ^~~~~~~
In file included from /usr/include/signal.h:291,
                 from build-gnulib/import/signal.h:52,
                 from ../../gdb/linux-nat.h:23,
                 from ../../gdb/aarch64-linux-nat.c:26:
/usr/include/x86_64-linux-gnu/bits/sigcontext.h:46:8: note: previous definition of ‘struct _fpxreg’
   46 | struct _fpxreg
      |        ^~~~~~~
In file included from ../../gdb/nat/aarch64-sve-linux-ptrace.h:23,
                 from ../../gdb/aarch64-linux-nat.c:35:
/usr/include/x86_64-linux-gnu/asm/sigcontext.h:98:8: error: redefinition of ‘struct _xmmreg’
   98 | struct _xmmreg {
      |        ^~~~~~~
In file included from /usr/include/signal.h:291,
                 from build-gnulib/import/signal.h:52,
                 from ../../gdb/linux-nat.h:23,
                 from ../../gdb/aarch64-linux-nat.c:26:
/usr/include/x86_64-linux-gnu/bits/sigcontext.h:53:8: note: previous definition of ‘struct _xmmreg’
   53 | struct _xmmreg
      |        ^~~~~~~
In file included from ../../gdb/nat/aarch64-sve-linux-ptrace.h:23,
                 from ../../gdb/aarch64-linux-nat.c:35:
/usr/include/x86_64-linux-gnu/asm/sigcontext.h:180:8: error: redefinition of ‘struct _ymmh_state’
  180 | struct _ymmh_state {
      |        ^~~~~~~~~~~
In file included from /usr/include/signal.h:291,
                 from build-gnulib/import/signal.h:52,
                 from ../../gdb/linux-nat.h:23,
                 from ../../gdb/aarch64-linux-nat.c:26:
/usr/include/x86_64-linux-gnu/bits/sigcontext.h:184:8: note: previous definition of ‘struct _ymmh_state’
  184 | struct _ymmh_state
      |        ^~~~~~~~~~~
In file included from ../../gdb/nat/aarch64-sve-linux-ptrace.h:23,
                 from ../../gdb/aarch64-linux-nat.c:35:
/usr/include/x86_64-linux-gnu/asm/sigcontext.h:192:8: error: redefinition of ‘struct _xstate’
  192 | struct _xstate {
      |        ^~~~~~~
In file included from /usr/include/signal.h:291,
                 from build-gnulib/import/signal.h:52,
                 from ../../gdb/linux-nat.h:23,
                 from ../../gdb/aarch64-linux-nat.c:26:
/usr/include/x86_64-linux-gnu/bits/sigcontext.h:189:8: note: previous definition of ‘struct _xstate’
  189 | struct _xstate
      |        ^~~~~~~
In file included from ../../gdb/nat/aarch64-sve-linux-ptrace.h:23,
                 from ../../gdb/aarch64-linux-nat.c:35:
/usr/include/x86_64-linux-gnu/asm/sigcontext.h:317:8: error: redefinition of ‘struct sigcontext’
  317 | struct sigcontext {
      |        ^~~~~~~~~~
In file included from /usr/include/signal.h:291,
                 from build-gnulib/import/signal.h:52,
                 from ../../gdb/linux-nat.h:23,
                 from ../../gdb/aarch64-linux-nat.c:26:
/usr/include/x86_64-linux-gnu/bits/sigcontext.h:139:8: note: previous definition of ‘struct sigcontext’
  139 | struct sigcontext
      |        ^~~~~~~~~~
In file included from ../../gdb/nat/aarch64-sve-linux-ptrace.h:29,
                 from ../../gdb/aarch64-linux-nat.c:35:
../../gdb/nat/aarch64-sve-linux-sigcontext.h:25:22: error: field ‘head’ has incomplete type ‘_aarch64_ctx’
   25 |  struct _aarch64_ctx head;
      |                      ^~~~
../../gdb/nat/aarch64-sve-linux-sigcontext.h:25:9: note: forward declaration of ‘struct _aarch64_ctx’
   25 |  struct _aarch64_ctx head;
      |         ^~~~~~~~~~~~
../../gdb/aarch64-linux-nat.c: In function ‘void fetch_fpregs_from_thread(regcache*)’:
../../gdb/aarch64-linux-nat.c:320:37: error: ‘elf_fpregset_t’ {aka ‘struct user_fpregs_struct’} has no member named ‘vregs’
  320 |  regcache->raw_supply (regno, &regs.vregs[regno - AARCH64_V0_REGNUM]);
      |                                     ^~~~~
../../gdb/aarch64-linux-nat.c:322:56: error: ‘elf_fpregset_t’ {aka ‘struct user_fpregs_struct’} has no member named ‘fpsr’
  322 |       regcache->raw_supply (AARCH64_FPSR_REGNUM, &regs.fpsr);
      |                                                        ^~~~
../../gdb/aarch64-linux-nat.c:323:56: error: ‘elf_fpregset_t’ {aka ‘struct user_fpregs_struct’} has no member named ‘fpcr’
  323 |       regcache->raw_supply (AARCH64_FPCR_REGNUM, &regs.fpcr);
      |                                                        ^~~~
../../gdb/aarch64-linux-nat.c: In function ‘void store_fpregs_to_thread(const regcache*)’:
../../gdb/aarch64-linux-nat.c:368:29: error: ‘elf_fpregset_t’ {aka ‘struct user_fpregs_struct’} has no member named ‘vregs’
  368 |      (regno, (char *) &regs.vregs[regno - AARCH64_V0_REGNUM]);
      |                             ^~~~~
../../gdb/aarch64-linux-nat.c:371:61: error: ‘elf_fpregset_t’ {aka ‘struct user_fpregs_struct’} has no member named ‘fpsr’
  371 |  regcache->raw_collect (AARCH64_FPSR_REGNUM, (char *) &regs.fpsr);
      |                                                             ^~~~
../../gdb/aarch64-linux-nat.c:373:61: error: ‘elf_fpregset_t’ {aka ‘struct user_fpregs_struct’} has no member named ‘fpcr’
  373 |  regcache->raw_collect (AARCH64_FPCR_REGNUM, (char *) &regs.fpcr);
      |                                                             ^~~~

最奇怪的是,如果我不配置--host=aarch64-linux-gnu,编译就OK了。 但是我想把“gdb”放到我的开发板上,我该如何解决这个错误? 我不知道为什么。请帮忙。

如何解决这个重新定义的错误?

linux gdb cross-compiling
© www.soinside.com 2019 - 2024. All rights reserved.