安装 arm-linux-gdb7.5 & 可能出现的两类问题解决

一般的安装过程可参考文章: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 -v
   target指明编译生成的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

安装过程可能遇到的问题:
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
即直接屏蔽Werror报警即可

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/52369017
                  http://blog.csdn.net/yangbingzhou/article/details/48286531

  • 6
    点赞
  • 12
    收藏
    觉得还不错? 一键收藏
  • 5
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 5
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值