1、编译配置
./configure --host=aarch64-rockchip-linux-gnu --target=aarch64-rockchip-linux-gnu --prefix=${PWD}/output
make -j8
make install
aarch64-rockchip-linux-gnu-strip output/gdb #去除符号,减小程序体积
若在PC机上运行,则--host不要指定;若在ARM板上运行则需要指定。gdbserver编译同理。通常gdb可以编译为PC上运行,gdbserver编译为arm板上运行
2、出现bfd头文件定义错误
--disable-werror
3、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
4、如果出现出现各种奇怪错误,网上无法查到,建议更换GDB版本,由于GCC版本问题,新旧GDB交叉编译存在编译不兼容的问题
参考:
https://blog.csdn.net/capture_bbom/article/details/64437791