安装arm-linux-gdb经验总结

1.arm-linux-gdb

 (1)到http://www.gnu.org/software/gdb/download/下载gdb包,这个没有要求,因为它是个软件,只要用对的工具链编译就OK了。

2.(2)在本机安装arm-linux-gdb客户端。

拷贝tar.gz 包到/opt目录下,tar -zxvf *.tar.gz

3.#cd gdb-7.2
  #./configure --target=arm-linux --prefix=/usr/local/arm-gdb –v(--target配置gdb的目标平台,--prefix配置安装路径)

#arm-unknown-linux-uclibcgnueabi-gcc -v (查看target)

可更改/etc/profile或~/.bash_profile或~/.bashrc,添加export PATH=$PATH:/usr/local/arm-gdb/bin,这样可以找到路径)

4.#make

5.如果报如下错误:

warning: argument to ‘sizeof’ in ‘void* memset(void*, int, size_t)’ call is the same expression as the destination; did you mean to dereference it? [-Wsizeof-pointer-memaccess]


在Makefile添加:
KBUILD_CFLAGS   += -Wno-sizeof-pointer-memaccess  (添加在任意位置)

6.我使用的GCC版本是4.3.3,在编译过程中报错:


/bin/sh ./libtool --mode=compile gcc -DHAVE_CONFIG_H -I. -I.././opcodes -I. -D_GNU_SOURCE -I. -I.././opcodes -I../bfd -I.././opcodes/../include -I.././opcodes/../bfd -I.././opcodes/../intl -I../intl   -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Werror -g -O2 -c -o arm-dis.lo arm-dis.c
gcc -DHAVE_CONFIG_H -I. -I.././opcodes -I. -D_GNU_SOURCE -I. -I.././opcodes -I../bfd -I.././opcodes/../include -I.././opcodes/../bfd -I.././opcodes/../intl -I../intl -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Werror -g -O2 -c arm-dis.c -o arm-dis.o
cc1: warnings being treated as errors
arm-dis.c: In function 'print_insn_thumb16':
arm-dis.c:2950: error: format not a string literal and no format arguments
arm-dis.c:2957: error: format not a string literal and no format arguments
arm-dis.c: In function 'print_insn_thumb32':
arm-dis.c:3491: error: format not a string literal and no format arguments
arm-dis.c:3499: error: format not a string literal and no format arguments
make[4]: *** [arm-dis.lo] Error 1
make[4]: Leaving directory `/opt/gdb-6.5/opcodes'
make[3]: *** [all-recursive] Error 1
make[3]: Leaving directory `/opt/gdb-6.5/opcodes'
make[2]: *** [all] Error 2
make[2]: Leaving directory `/opt/gdb-6.5/opcodes'
make[1]: *** [all-opcodes] Error 2
make[1]: Leaving directory `/opt/gdb-6.5'
make: *** [all] Error 2


我当时是进入bfd 文件夹下

将所有 /bin/sh ./libtool 提示都在该路径下执行一遍

修改bfd文件夹下面的Makefile文件;


7.返回Makefile 目录执行make 成功。。。

8.#make install

9.进入gdb/gdbserver目录:
[root@dding gdbserver]# pwd
/opt/gdb-7.2/gdb/gdbserver

10.[root@dding gdbserver]# 必须在gdbserver目录下运行配置命令,此时才能用相对路径
#./configure --target=arm-linux --host=arm-linux
(--target=arm-linux表示目标平台,--host表示主机端运行的是arm-linux-gdb,不需要配置—prefix,因为gdbserver不在主机端安装运行)
#make CC=/usr/local/arm/2.95.3/bin/arm-linux-gcc

路径使用which arm-unknown-linux-uclibcgnueabi-gcc 

也可以修改该路径下面的Makefile文件,CC = arm-unknown-linux-uclibcgnueabi-gcc

11.当编译出现错误时,会发现thread-db.c报错,此时需要注释掉Makefile中,和thread-db相关部分,之后编译会提示linux-low.o文件不通过,注释该文件中相应行;

注释proc-service.c相关行,注释linux-low.c相关行;

Makefile:111: *** commands commence before first target.  Stop. 当出现该信息时,由于注释Makefile时出现错误导致;直接删除相关行;


linux-low.o:(.data+0x5c): undefined reference to `thread_db_get_tls_address'
linux-low.o:(.data+0x80): undefined reference to `thread_db_handle_monitor_command'

出现如上提示时,注释掉linux-low.c中相应字段;


修改arm-linux-gcc编译器后需要重启机器生效;

你可能感兴趣的:(嵌入式)