Day: February 10, 2013

Crosscompiling GDB 7.5 for ARM

If you want to crosscompile GDB for your Linux ARM system, then you need first to cross-compile termcap:

$ export ARCH=arm
$ export CROSSCOMPILE=arm-linux-
$ export PATH=/usr/local/arm/3.4.6/bin:$PATH
$ wget
$ tar xvf termcap-1.3.1.tar.gz
$ cd termcap-1.3.1/
$ CC=${CROSSCOMPILE}gcc ./configure --host=arm-linux --prefix=/usr
$ make
$ sudo make install

Copy termcap lib and header files to your toolchain (this is my toolchain example)

$ cd /usr/local/arm/3.4.6/arm-linux/lib/
$ sudo mv /usr/lib/libtermcap.a .
$ cd /usr/local/arm/3.4.6/arm-linux/include/
$ sudo mv /usr/include/termcap.h .

Download GDB:

$ wget
$ tar xvf gdb-7.5.tar.bz2
$ cd gdb-7.5

Add this define PTRACE_GETSIGINFO otherwise you will receive an error message:

$ vi gdb/gdbserver/linux-arm-low.c
#define PTRACE_GETSIGINFO    0x4202

Cross-compile GDB:

$ CC=arm-linux-gcc ./configure --target=arm-linux --build=x86-linux --host=arm-linux --enable-static=yes