Pages

Thursday, March 17, 2011

Building GDB 7.2 for ARM architecture on x86_64 host using a cross compiler

I just want to share my experience of build a GDB 7.2 from sources for the ARM architecture using an ARM cross compiler. We use Ubuntu 10 as development environment and BeagleBoard C4 as an ARM development board. At firt you must download the GDB (download here) and the TermCap Library (download here).

At first we need to build the termcap library:
1. wget ftp://ftp.gnu.org/gnu/termcap/termcap-1.3.1.tar.gz
2. tar xvzf termcap-1.3.1.tar.gz
3. cd ./termcap-1.3.1
4. export CC=/home/tigran/x-tools/gcc-4.5-20100603/bin/arm-unknown-linux-gnueabi-gcc (Replace with path to your cross compiler)
5. ./configure --host=arm-linux-gnueabi --prefix='/home/tigran/termcap' (Repleace with path where you want to store termcap binaries)
6. make
7. make install

Next we'll build the gdb itself:
0. cd ./gdb-7.2
1. Set the necessary global variables
export CC=/home/tigran/x-tools/gcc-4.5-20100603/bin/arm-unknown-linux-gnueabi-gcc
(Replace with path to your cross compiler)

export LDFLAGS="-static -L/home/tigran/termcap/lib"
Replace the path to your TermCap library

export CFLAGS="-g -O2 -I/home/tigran/termcap/include"
Replace the path to your TermCap library

2. ./configure --host=arm-linux-gnueabi --prefix='/home/tigran/gdb' --disable-werror # &&
3. make &&
4. make install

The build process will take about 10-15 min depending on your server configuration.

Usefull links:
http://www.linux.com/archive/feature/121735
http://cplusadd.blogspot.com/2009/05/compiling-and-using-gdb-for-arm-linux.html
http://trac.cross-lfs.org/wiki/download#DownloadtheCrossLinuxFromScratchBook

3 comments:

Unknown said...

Thanks you so much man. Your explanation is way much clear than other tutorials. It worked for me thanx :)

Unknown said...

Thanks you so much man. Your explanation is way much clear than other tutorials. It worked for me thanx :)

Unknown said...

Very nice and bang on blog. Thanks so much. It worked like a charm