Compiling static GDB for Android

sudo apt-get install gcc-arm-linux-gnueabi g++-arm-linux-gnueabi texinfo

export CC=/usr/bin/arm-linux-gnueabi-gcc
export STRIP=/usr/bin/arm-linux-gnueabi-strip
export CFLAGS=”-march=armv7-a -O2 -static”
export LD_FLAGS=”-static”
export NM=/usr/bin/arm-linux-gnueabi-nm
export AR=/usr/bin/arm-linux-gnueabi-ar
export LD=/usr/bin/arm-linux-gnueabi-ld
export CPP=/usr/bin/arm-linux-gnueabi-cpp
export CXX=/usr/bin/arm-linux-gnueabi-g++
export AS=/usr/bin/arm-linux-gnueabi-as

So we make them all one giant command:
export CC=/usr/bin/arm-linux-gnueabi-gcc && export STRIP=/usr/bin/arm-linux-gnueabi-strip && export CFLAGS=”-march=armv7-a -O2 -static” && export LD_FLAGS=”-static” && export NM=/usr/bin/arm-linux-gnueabi-nm && export AR=/usr/bin/arm-linux-gnueabi-ar && export LD=/usr/bin/arm-linux-gnueabi-ld && export CPP=/usr/bin/arm-linux-gnueabi-cpp && export CXX=/usr/bin/arm-linux-gnueabi-g++ && export AS=/usr/bin/arm-linux-gnueabi-as

Next we configure and create the Makefile:
./configure –host=arm-linux –prefix=/arm/gdb –enable-static

Then we make with -static as mine seemed to ignore the export LD:
make LDFLAGS=-static

Leave a Reply