makefile - gdb编译问题yyin和lexer_init

标签 makefile compilation gdb bison

我尝试在 Ubuntu 18.04 中编译 gdb 9.2,打印出以下错误。

make[2]: Entering directory '/home/ata/gdb-9.2/build/gdb'
  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
ada-exp.y:736:15: note: suggested alternative: ‘yylen’
ada-exp.y:736:3: error: ‘lexer_init’ was not declared in this scope
ada-exp.y:736:3: note: suggested alternative: ‘pex_init’
In file included from ada-exp.y:56:0:

在此之前gdb 10.1已编译成功。

我在网上搜索但找不到原因或解决方案。

可能是什么问题?

编辑1:我有gcc版本7.5.0

最佳答案

我也遇到了这个问题,这就是我解决它的方法:
ada-exp.y 包含文件 ada-lex.c,其中包含函数 lexer_init 的定义。
但如果您最初没有安装 Flex,那么它可能会生成一个空的 ada-lex.c(来自 ada-lex.l)。即使您执行 make clean,它也不会清除生成的 ada-lex.c,即,在下一个编译命令时它也将保持为空。
因此,要修复此错误,您可以删除所有此类中间 .c 文件(在您的情况下,使用新的 .tar.gz 进行构建)并再次执行 make。

关于makefile - gdb编译问题yyin和lexer_init,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64661573/

相关文章:

debugging - 使用 gdb 调试 qemu

gdb - 将 gdb 与/proc/kcore 一起使用时,为什么我的 vmlinux 中没有调试符号?

linux - 如何将交叉编译的cups安装到目标板?

c++ - G++ 如何编译不打开控制台的程序。它必须是多平台的,而不仅仅是 Windows。

makefile:删除重复的单词而不进行排序

qt - 静态编译 Qt 4.6.2

c++ - C++中如何链接头文件

gdb - 大二进制文件的制表符完成中断

ios - 架构 armv7 错误的 undefined symbol

build - Make有现代替代品吗?