2017-01-09 215 views
4

我在與最新的gdb一個問題,所以我想用一老一。我發現gdb存檔here但我怎麼編譯/安裝其中之一,所以它可以用嗎?安裝較舊版本的gdb

按照manual,第一configure

$ ./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

$ 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[] = "abcdef"; 
        ^~~~~~~~ 
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 

回答

5

您嘗試使用新的GCC編譯舊GDB。

這通常不起作用:新的GCC支持新的警告,和GDB開發者修復這些警告(新版本的GCC實際發佈前通常)。

你應該能夠禁用這些警告:

./configure 'CFLAGS=-w' 

或通過編輯生成的Makefile文件並修改CFLAGS那裏。

其他替代方案:

  • 你實際上可以修復代碼不產生警告(刪除行remote-utils.c 436應該這樣做),或
  • ,你可以安裝舊的相同的「復古」 GCC ,並建立GDB與它(也許在虛擬機)。
1

您可以使用此命令來檢查錯誤相關的配置標誌:

./configure --help | grep error

有你應該看到:

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

所以,你可以禁用警告作爲錯誤:

./configure --disable-werror

相關問題