[英]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.