3559 编译gdb-7.9
1、安装ncurses-6.0 这个在3559 sdk中有,可以直接使用
./configure --with-shared --without-debug --without-ada --enable-overwrite
2、编译gdb
./configure --target=aarch64-himix100-linux --prefix=/opt/hisi-linux/x86-arm/hi3559av100_aarch64_himix100_gdb/ --disable-werror --with-python
3、编译gdbserver
./configure --target=aarch64-himix100-linux --prefix=/opt/hisi-linux/x86-arm/hi3559av100_aarch64_himix100_gdb/ --disable-werror CC=/opt/hisi-linux/x86-arm/aarch64-himix100-linux/bin/aarch64-himix100-linux-gcc AR=/opt/hisi-linux/x86-arm/aarch64-himix100-linux/bin/aarch64-himix100-linux-ar --host=aarch64-himix100-linux CFLGAS='-mcpu=cortex-a73.cortex-a53 $CFLAGS'
编译gdbserver过程中会遇到这样的错误,
proc-service.c:148:1: error: conflicting types for 'ps_lsetfpregs'
ps_lsetfpregs (gdb_ps_prochandle_t ph, lwpid_t lwpid, void *fpregset)
proc-service.c:148:1: error: conflicting types for 'ps_lsetfpregs'
ps_lsetfpregs (gdb_ps_prochandle_t ph, lwpid_t lwpid, void *fpregset)
linux-aarch64-low.c:1090:1: error: conflicting types for 'ps_get_thread_area'
ps_get_thread_area (const struct ps_prochandle *ph,
需要将上面出错的文件中的重复函数定义注释掉
解决方法参考了下面的文章 转载
问题1:
error: this statement may fall through [-Werror=implicit-fallthrough=]
error: right-hand operand of comma expression has no effect [-Werror=unused-value]
error: ‘hexchars’ defined but not used [-Werror=unused-const-variable=
解决:make CFLAGS=’-Wno-implicit-fallthrough -Wno-unused-value -Wno-unused-const-variable’
问题2:
configure: error: no termcap library found
解决:
下载termcap源码安装,下载地址:https://ftp.gnu.org/gnu/termcap/
问题3:
amd64-linux-nat.c:485:1: error: conflicting types for ‘ps_get_thread_area’
linux-x86-low.c:167:1: error: conflicting types for ‘ps_get_thread_area’
还有几处冲突得,使用相同得处理方法
解决:修改文件gdb-7.6.1/gdb/amd64-linux-nat.c gdb-7.6.1/gdb/gdbserver/linux-x86-low.c
,屏蔽ps_get_thread_area定义(不确定是否有影响)
参考链接:https://www.lizhongyi.com/archives/ubuntu12-04%E5%8D%87%E7%BA%A7c11%E6%A0%87%E5%87%86/