升級GDB版本
在開發環境的遷移中,出現前后gdb版本不一致的情況,導致編譯以及調試的過程出現問題,下面總結如何升級Linux系統的
包下載地址: http://ftp.gnu.org/gnu/gdb/
升級步驟:
tar -zxvf gdb-7.9.1.tar.gz
cd gdb-7.9.1
./configure
make
make install
在make install的時候很大幾率會報錯:
WARNING: 'makeinfo' is missing on your system.
You should only need it if you modified a '.texi' file, or
any other file indirectly affecting the aspect of the manual.
You might want to install the Texinfo package:
The spurious makeinfo call might also be the consequence of
using a buggy 'make' (AIX, DU, IRIX), in which case you might
want to install GNU make:
make[5]: *** [gdb.info] Error 127
make[5]: Leaving directory `/home/share/bug/core/gdb-7.12/gdb/doc'
make[4]: *** [subdir_do] Error 1
make[4]: Leaving directory `/home/share/bug/core/gdb-7.12/gdb'
make[3]: *** [install-only] Error 2
make[3]: Leaving directory `/home/share/bug/core/gdb-7.12/gdb'
make[2]: *** [install] Error 2
make[2]: Leaving directory `/home/share/bug/core/gdb-7.12/gdb'
make[1]: *** [install-gdb] Error 2
make[1]: Leaving directory `/home/share/bug/core/gdb-7.12'
make: *** [install] Error 2
ok,說系統少 makeinfo 組件,那我們安裝就好了:
yum install texinfo
注意,這里安裝的包名是 texinfo
繼續 make install
一般都能順利完成編譯,完成后,本地就會有個 gdb 目錄,里面就有gdb的二進制文件!
做軟連接:
mv /usr/local/bin/gdb /usr/local/bin/gdb_bak
ln -s /root/gdb-7.9.1/gdb/gdb /usr/local/bin/gdb
此時發現還是不行,是因為我們做的軟連接沒做到正確的path文件上去,再找找其他的gdb!
哎,又發現一個:
mv /usr/bin/gdb /usr/bin/gdb_bak
cp gdb /usr/bin/gdb
ok,gdb的版本顯示ok了,但是在進入交互式界面的時候,出現了python報錯,說找不到gdb的庫,並且把位置都列給你了:/usr/share/gdb/python
ok,那么此時我們把新編譯的gdb的對應python庫打包過去就好了。
cd /root/gdb-7.9.1/gdb/python/lib/gdb
tar -zcvf gdb.tgz gdb
mv gdb.tgz /usr/share/gdb/python
cd /usr/share/gdb/python
tar -zxvf gdb.tgz
到此,再次嘗試進入交互界面,發現報錯沒了,OK,gdb升級完成!