升级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升级完成!