自动交叉编译 gdb-7.9 脚本
#!/bin/sh
CPU_CORES="`cat /proc/cpuinfo |grep "processor"|wc -l`"
#CROSS_COMPILE=""
CROSS_COMPILE="arm-linux-"
CROSS_ARCH="arm"
# Download TermCap
wget ftp://ftp.gnu.org/gnu/termcap/termcap-1.3.1.tar.gz
# Download GDB Library
wget ftp://ftp.gnu.org/gnu/gdb/gdb-7.9.tar.xz
rm -Rf install
# Compile Termcap
rm -Rf termcap-1.3.1
tar zxvf termcap-1.3.1.tar.gz
cd termcap-1.3.1/
./configure --prefix="$PWD/../install"
make CC="${CROSS_COMPILE}gcc" AR="${CROSS_COMPILE}ar" RANLIB="${CROSS_COMPILE}ranlib"
make -j${CPU_CORES}
make install
cd ../
#exit
# Compile GDB
rm -Rf gdb-7.9
tar xvf gdb-7.9.tar.xz
cd gdb-7.9/
./configure --host="${CROSS_ARCH}-linux" --prefix="$PWD/../install" --without-x --disable-gdbtk --disable-tui --without-included-regex --without-included-gettext CC="${CROSS_COMPILE}gcc" CXX="${CROSS_COMPILE}g++" AR="${CROSS_COMPILE}ar" CPPFLAGS="-I$PWD/../gdb/include" LDFLAGS="-L$PWD/../install/lib -ltermcap -lm"
make CC=${CROSS_COMPILE}gcc
make install
cd ../
把上述脚本拷贝到 autocc.sh 文件中并执行
目录下会生成一个 install 目录,其中包含 gdb 的执行文件。