一般的安装过程可参考文章:http://blog.csdn.net/kangear/article/details/8635029
安装过程,如下:
下载gdb-7.5.tar.gz(http://www.gnu.org/software/gdb/download/)
1、将gdb-7.5.tar.gz拷贝到/usr/local/目录下(可以拷贝到任何你愿意的Linux目录下)
2、解压gdb-7.5.tar.gz
tar -zxvf gdb-7.5.tar.gz
3、编译arm-linux-gdb
到目录gdb-7.5: cd gdb-7.5执行:$./configure --target=arm-linux --prefix=/usr/local/arm-gdb -vtarget指明编译生成的GDB用于调试ARM-LINUX程序,prefix指明安装目录$make#make install#gedit /etc/environment --把arm-linux-gdb加入环境变量 (:/usr/local/arm-gdb/bin)#source /etc/environment //更新环境变量这样就可以在/usr/local/arm-gdb/bin目录下看到如下三个可执行文件arm-linux-gdb arm-linux-gdbtui arm-linux-run即直接屏蔽Werror报警即可
安装过程可能遇到的问题:1、 /bin/sh ./libtool --mode=compile gcc -DHAVE_CONFIG_H -I. -I.././bfd -I. -I. -I.././bfd -I.././bfd/../include -I.././bfd/../intl -I../intl -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Werror -g -O2 -c -o opncls.lo opncls.c
gcc -DHAVE_CONFIG_H -I. -I.././bfd -I. -I. -I.././bfd -I.././bfd/../include -I.././bfd/../intl -I../intl -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Werror -g -O2 -c opncls.c -o opncls.o
In file included from opncls.c:24:0:
opncls.c: In function 'bfd_fopen':
bfd.h:537:65: error: right-hand operand of comma expression has no effect [-Werror=unused-value]
#define bfd_set_cacheable(abfd,bool) (((abfd)->cacheable = bool), TRUE)
^
opncls.c:234:5: note: in expansion of macro 'bfd_set_cacheable'
bfd_set_cacheable (nbfd, TRUE);
^
cc1: all warnings being treated as errors
Makefile:1010: recipe for target 'opncls.lo' failed
make[4]: *** [opncls.lo] Error 1
make[4]: Leaving directory '/home/ygl/smb_share/work/nfs_pro/gdb-6.5/bfd'
Makefile:1029: recipe for target 'all-recursive' failed
make[3]: *** [all-recursive] Error 1
make[3]: Leaving directory '/home/ygl/smb_share/work/nfs_pro/gdb-6.5/bfd'
Makefile:924: recipe for target 'all' failed
make[2]: *** [all] Error 2
make[2]: Leaving directory '/home/ygl/smb_share/work/nfs_pro/gdb-6.5/bfd'
Makefile:2716: recipe for target 'all-bfd' failed
make[1]: *** [all-bfd] Error 2
make[1]: Leaving directory '/home/ygl/smb_share/work/nfs_pro/gdb-6.5'
Makefile:629: recipe for target 'all' failed
make: *** [all] Error 2上述错误的原因是:源码中有些函数定义不规范,用对函数格式非常严格的GCC 4.5编译就会出错,而GCC 4.1 不会报错。我们进入错误提示的bdf文件的Makefile中,可看到如下内容
解决:重新执行上述所有步骤,关键是将配置改为./configure--target=arm-linux--disable-werror --prefix=/usr/local/arm-gdb -v
2、如果还遇到:
error: no termcap library found
checking for library containing gethostbyname... none required
checking for library containing socketpair... none required
checking for library containing waddstr... no
checking for library containing dlgetmodinfo... no
checking for library containing tgetent... no
configure: error: no termcap library found
make[1]: *** [configure-gdb] 错误 1
上述错误的原因是:缺少前置文件,执行安装:sudo apt-get install libncurses5-dev安装过程如果出现texinfo相关的错误,则请执行:sudo apt-get install texinfo正确安装后,会在指定安装路径下生成:bin、include、lib、share文件夹在文件/etc/profile最后加上export PATH=$PATH:/opt/arm-gdb/bin 使刚配置的环境变量生效: source/etc/profile
注意如果之前安装的arm-linux-gcc里面也存在gdb的话,为了使用刚刚安装的7.5版本gdb,应将gdb7.5添加在gcc的环境变量前面。保证优先使用gdb7.5而不是gcc套件里的gdb
本文参考:http://blog.csdn.net/ygl840455828ygl/article/details/52369017http://blog.csdn.net/yangbingzhou/article/details/48286531