我在使用最新的gdb
时遇到问题,因此我想使用较旧的gdb
。我找到了configure
存档文件here,但是如何编译/安装其中一个文件以便可以使用?
根据manual,第一个make
:
$ ./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
然后ojit_code:
$ 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
[...]
但这会导致错误:
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
关于降级程序的指南发现here也无济于事,因为我总是遇到“找不到版本”错误:
$ 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
最佳答案
您正在尝试使用较新的GCC编译较旧的GDB。
这通常不起作用:较新的GCC会启用新的警告,而GDB开发人员会修复这些警告(通常在实际发布新的GCC版本之前)。
您应该能够通过以下方式禁用这些警告:
./configure 'CFLAGS=-w'
或者通过编辑生成的Makefile并在此处修改
CFLAGS
来实现。其他替代方案:
remote-utils.c
的第436行来做到这一点),或者关于linux - 安装较旧的gdb版本,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/41556448/