[英]GDB compilation fails with MSYS2 under Windows
我需要为 Linux 目标编译 GDB,但要使用 Windows 主机操作系统。 (目标是有可能在 Windows 上运行 GDB 客户端并将其连接到运行在 Linux 上的 gdbserver)。
我正在使用 GDB sources v 9.2 和以下配置命令:
../configure --build=x86_64-w64-mingw64 --target=x86_64-unknown-linux-gnu
它从 gdb golder 中的构建目录运行。
我收到以下错误:
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 中尝试过。
您可以尝试--build=x86_64-w64-mingw32
而不是--build=x86_64-w64-mingw64
并使用 MinGW64 shell 而不是 MSYS2 shell 吗? (AFAIR 配置中有一些脚本匹配 *-*-mingw32* 但不匹配 *-*-mingw* - 我相信过去使用--build=x86_64-w64-mingw32
对我有帮助)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.