首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >安装旧的gdb版本

安装旧的gdb版本
EN

Stack Overflow用户
提问于 2017-01-09 20:33:01
回答 2查看 3.9K关注 0票数 6

我对最新的gdb有问题,所以我想使用旧的。我找到了gdb归档这里,但是我如何编译/安装其中的一个,以便可以使用它?

根据手册的说法,第一configure

代码语言:javascript
复制
$ ./configure
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking target system type... x86_64-unknown-linux-gnu
[...]
configure: creating ./config.status
config.status: creating Makefile

然后是make

代码语言:javascript
复制
$ make
make[1]: Entering directory '/root/Desktop/gdb-7.7'
Configuring in ./libiberty
configure: creating cache ./config.cache
checking whether to enable maintainer-specific portions of Makefiles... no
checking for makeinfo... /root/Desktop/gdb-7.7/missing makeinfo --split-size=5000000
[...]

但它会导致一个错误:

代码语言:javascript
复制
remote-utils.c:436:19: error: ‘hexchars’ defined but not used [-Werror=unused-const-variable=]
 static const char hexchars[] = "0123456789abcdef";
                   ^~~~~~~~
cc1: all warnings being treated as errors
Makefile:238: recipe for target 'remote-utils.o' failed
make[4]: *** [remote-utils.o] Error 1
make[4]: Leaving directory '/root/Desktop/gdb-7.7/gdb/gdbserver'
Makefile:1345: recipe for target 'subdir_do' failed
make[3]: *** [subdir_do] Error 1
make[3]: Leaving directory '/root/Desktop/gdb-7.7/gdb'
Makefile:1018: recipe for target 'all' failed
make[2]: *** [all] Error 2
make[2]: Leaving directory '/root/Desktop/gdb-7.7/gdb'
Makefile:8611: recipe for target 'all-gdb' failed
make[1]: *** [all-gdb] Error 2
make[1]: Leaving directory '/root/Desktop/gdb-7.7'
Makefile:832: recipe for target 'all' failed
make: *** [all] Error 2

关于降级程序的指南发现,这里也没有帮助,因为我总是收到“未找到版本”错误:

代码语言:javascript
复制
$ sudo apt-get install gdb="7.8.1"
Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: Version '7.8.1' for 'gdb' was not found
EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2017-01-10 02:01:57

您正在尝试使用更新的GCC编译一个较旧的GDB。

这通常不起作用:更新的GCC启用了新的警告,而GDB开发人员修复了这些警告(通常在GCC新版本实际发布之前)。

您应该能够通过以下方式禁用这些警告:

代码语言:javascript
复制
 ./configure 'CFLAGS=-w'

或者通过编辑生成的Makefile并在那里修改CFLAGS

其他替代办法:

  • 实际上,您可以修正代码以避免产生警告(删除remote-utils.c的第436行应该这样做),或者
  • 您可以安装同样“老式”的老GCC,并使用它构建GDB (可能在虚拟机中)。
票数 6
EN

Stack Overflow用户

发布于 2017-01-10 20:51:22

可以使用以下命令检查与错误相关的配置标志:

./configure --help | grep error

在这里你应该看到:

--enable-werror enable -Werror in bootstrap stage2 and later

因此,您可以禁用将警告视为错误:

./configure --disable-werror

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/41556448

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档