【问题标题】:GDB compilation fails with MSYS2 under WindowsGDB 编译在 Windows 下使用 MSYS2 失败
【发布时间】:2020-11-07 03:08:26
【问题描述】:

我需要为 OS Linux 目标编译 GDB,但需要使用 Windows 主机操作系统。 (目标是有可能在 Windows 上运行 GDB 客户端并将其连接到在 Linux 上运行的 gdbserver)。

我正在使用 GDB 源 v 9.2 和以下配置命令:

../configure --build=x86_64-w64-mingw64 --target=x86_64-unknown-linux-gnu

它从 gdb golder 中的 build 目录运行。

我收到以下错误:

mkdir -p -- nat/.deps
  CXX    gdb.o
  CXX    ada-exp.o
ada-exp.y: In function 'int ada_parse(parser_state*)':
ada-exp.y:736:15: error: 'yyin' was not declared in this scope; did you mean 'yyrline'?
ada-exp.y:736:3: error: 'lexer_init' was not declared in this scope; did you mean 'pex_init'?
In file included from ada-exp.y:56:
ada-exp.y: At global scope:
ada-exp.y:55:29: warning: 'int ada_yylex()' declared 'static' but never defined [-Wunused-function]
../../gdb/yy-remap.h:38:39: note: in definition of macro 'GDB_YY_REMAP_2'
   38 | #define GDB_YY_REMAP_2(PREFIX, YYSYM) PREFIX ## YYSYM
      |                                       ^~~~~~
../../gdb/yy-remap.h:40:29: note: in expansion of macro 'GDB_YY_REMAP_1'
   40 | #define GDB_YY_REMAP(YYSYM) GDB_YY_REMAP_1 (GDB_YY_REMAP_PREFIX, YYSYM)
      |                             ^~~~~~~~~~~~~~
../../gdb/yy-remap.h:40:45: note: in expansion of macro 'GDB_YY_REMAP_PREFIX'
   40 | #define GDB_YY_REMAP(YYSYM) GDB_YY_REMAP_1 (GDB_YY_REMAP_PREFIX, YYSYM)
      |                                             ^~~~~~~~~~~~~~~~~~~
../../gdb/yy-remap.h:44:16: note: in expansion of macro 'GDB_YY_REMAP'
   44 | #define yylex  GDB_YY_REMAP (yylex)
      |                ^~~~~~~~~~~~
ada-exp.y:78:12: note: in expansion of macro 'yylex'
ada-exp.y:55:29: warning: 'int ada_yylex()' used but never defined
../../gdb/yy-remap.h:38:39: note: in definition of macro 'GDB_YY_REMAP_2'
   38 | #define GDB_YY_REMAP_2(PREFIX, YYSYM) PREFIX ## YYSYM
      |                                       ^~~~~~
../../gdb/yy-remap.h:40:29: note: in expansion of macro 'GDB_YY_REMAP_1'
   40 | #define GDB_YY_REMAP(YYSYM) GDB_YY_REMAP_1 (GDB_YY_REMAP_PREFIX, YYSYM)
      |                             ^~~~~~~~~~~~~~
../../gdb/yy-remap.h:40:45: note: in expansion of macro 'GDB_YY_REMAP_PREFIX'
   40 | #define GDB_YY_REMAP(YYSYM) GDB_YY_REMAP_1 (GDB_YY_REMAP_PREFIX, YYSYM)
      |                                             ^~~~~~~~~~~~~~~~~~~
../../gdb/yy-remap.h:44:16: note: in expansion of macro 'GDB_YY_REMAP'
   44 | #define yylex  GDB_YY_REMAP (yylex)
      |                ^~~~~~~~~~~~
ada-exp.y:78:12: note: in expansion of macro 'yylex'
ada-exp.y:1437:1: warning: 'type* type_char(parser_state*)' defined but not used [-Wunused-function]
ada-exp.y:1431:1: warning: 'type* type_long_double(parser_state*)' defined but not used [-Wunused-function]
ada-exp.y:1425:1: warning: 'type* type_long_long(parser_state*)' defined but not used [-Wunused-function]
ada-exp.y:1419:1: warning: 'type* type_long(parser_state*)' defined but not used [-Wunused-function]
make[2]: *** [Makefile:2370: ada-exp.o] Error 1
make[2]: Leaving directory '/z/tools/gdb-9.2/build/gdb'
make[1]: *** [Makefile:9572: all-gdb] Error 2
make[1]: Leaving directory '/z/tools/gdb-9.2/build'
make: *** [Makefile:860: all] Error 2

这是我安装的:

$ pacman -Qe
base 2020.05-2
bison 3.6.4-1
btyacc 20200330-1
flex 2.6.4-1
gdb 9.2-1
make 4.3-1
mingw-w64-x86_64-gcc 10.1.0-3
mingw-w64-x86_64-gcc-ada 10.1.0-3
mingw-w64-x86_64-python-ply 3.11-1
texinfo 6.7-2

已从 MSYS2 和 MINGW64 shell 中尝试过。

【问题讨论】:

    标签: windows compilation gdb msys2


    【解决方案1】:

    您可以尝试--build=x86_64-w64-mingw32 代替--build=x86_64-w64-mingw64 并使用MinGW64 shell 而不是MSYS2 shell? (AFAIR 中有一些脚本匹配 *-*-mingw32* 但不匹配 *-*-mingw* - 我相信过去使用 --build=x86_64-w64-mingw32 对我有帮助)。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-12-07
      • 2023-03-16
      • 1970-01-01
      • 1970-01-01
      • 2012-05-04
      • 1970-01-01
      相关资源
      最近更新 更多