交叉编译GDB


PC主机安装必要软件

sudo apt-get install bison flex expect-dev build-essential m4 autoconf automake texi2html

源码下载

  • gdb
  • ncurses
  • termcap

编译termcap

wget https://ftp.gnu.org/gnu/termcap/termcap-1.3.1.tar.gz
# 编译命令
./configure --host=armv7-fullhanv3-linux-gnueabihf --prefix=/opt/arm_root
make && make install 

make install的时候报错/usr/bin/install: cannot remove ‘/usr/include/termcap.h’: Permission denied 不用理它。

编译ncurses

./configure --prefix=/opt/arm_root --host=armv7-fullhanv3-linux-gnueabihf --with-shared
make && make install

make install时出错,可以手动把lib/目录下文件拷贝到install/lib目录。

编译gdb

wget https://ftp.gnu.org/gnu/gdb/gdb-8.2.1.tar.xz
# 编译命令
LDFLAGS="-L/opt/arm_root/lib" CFLAGS="-I/opt/arm_root/include" CXXFLAGS="-I/opt/arm_root/include" ./configure --host=arm-926ejs-linux-gnueabi --target=arm-926ejs-linux-gnueabi --prefix=/opt/arm_root --enable-static --disable-tui
make && make install

参考