安装交叉调试器gdb,编译出错cc1: warnings being treated as errors

安装交叉调试器ARM-GDB(解决cc1: warnings being treated as errors)

1,下载GDB源码包并解压;

2,./configure --target=arm-linux --prefix=/opt/arm-gdb

配置--target和--prefix,指定目标板体系结构和安装路径;

3,make

我使用的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

这是源码中有些函数定义不规范,用对函数格式非常严格的GCC 4.3编译就会出错,而GCC 4.1 不会报错。

自然不乐意重新安装GCC退回到4.1的版本来解决这个问题,我是这样做的。

$cd /opt/gdb-6.5/opcodes

进入编译出错的目录;

$/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 -g -O2 -c -o arm-dis.lo arm-dis.c

将上面编译时出差的命令拷贝,去掉“-Werror”后执行,只有警告信息,没有报错误。

$cd ..

推出子目录

$make

继续make

4,make install

即在/opt/arm-gdb目录下得到arm-linux-gdb工具

你可能感兴趣的:(应用程序)