brew symbian gcc
Compilation d'une chaine de compilation ARM (Brew, Symbian, WiMo ...)
Posted by Jean-Michel Frouin on .Script compilant une chaine de compilation ARM pouvant servir pour Brew, Symbian, Windows Mobile ... n'importe quel OS fonctionnant avec un processeur ARM.
Commentaires du script :
On installe des paquets essentiels :
#!/bin/bash
#echo "Press Key - Installing ${TARGET} for build the Cross Compil Chain for Brew"
#sudo apt-get update
#sudo apt-get install libncurses5-dev gcc texinfo libmpc-dev libmpfr-dev
On définie le format de sortie du compilateur:
#Target #TARGET=arm-none-eabi TARGET=arm-elf
Les différentes version des composants principaux de la chaine complète de compilation :
- binutils ou GNU Binary Utilities: des outils manipulant le format binaire.
- gcc ou GNU Compiler Collection: le compilateur à proprement parlé.
- newlib ou The Red Hat newlib C Library: une librairie, écrite en C. (fournie notamment stdlib.h)
- gdb ou GNU Debugger
#Versions BINUTILS_VER=2.20.1 GCC_VER=4.5.0 NEWLIB_VER=1.18.0 GDB_VER=7.1
Ici on lui indique où l'on veut qu'il se compile, assemble, link ... :
PREFIX=/opt/toolchains/${TARGET}_${BINUTILS_VER}_${GCC_VER}_${NEWLIB_VER}_${GDB_VER}
Et enfin un échantillon des nombreuses options à ajuster pour compiler sur un OS, plutôt qu'un autre:
#Options
BINUTILS_OPTIONS='--target='${TARGET}' --prefix='${PREFIX}' --enable-interwork --enable-multilib --disable-nls --disable-shared --disable-threads --with-gcc --with-gnu-as --with-gnu-ld'
#BOOT_GCC_OPTIONS='--target='${TARGET}' --prefix='${PREFIX}' --enable-interwork --enable-multilib --disable-nls --disable-shared --disable-threads --disable-libstdc++ --disable-libssp --disable-libstdcxx-pch --disable-libmudflap --disable-libgomp --with-gmp='${PREFIX}' --with-mpfr='${PREFIX}' --with-mpc='${PREFIX}' --enable-languages=c --with-newlib --with-headers=../newlib-'${NEWLIB_VER}'/newlib/libc/include --with-gcc --with-gnu-as --with-dwarf2 -v'
#--with-specs='%{O2:%{!fno-remove-local-statics: -fremove-local-statics}} %{O*:%{O|O0|O1|O2|Os:;:%{!fno-remove-local-statics: -fremove-local-statics}}}'
#GCC_OPTIONS='--target='${TARGET}' --prefix='${PREFIX}' --enable-threads --disable-libmudflap --disable-libssp --disable-libstdcxx-pch --enable-extra-sgxxlite-multilibs --with-gnu-as --with-gnu-ld --enable-languages=c,c++ --disable-shared --disable-lto --with-newlib --disable-nls --with-headers=yes --disable-libgomp --enable-poison-system-directories --with-float=soft --disable-werror'
GCC_OPTIONS='--target='${TARGET}' --prefix='${PREFIX}' --disable-threads --disable-libmudflap --disable-libssp --disable-libstdcxx-pch --enable-languages=c,c++ --disable-shared --with-newlib --disable-nls --with-headers=yes --disable-libgomp --with-float=soft --disable-werror'
#--with-gmp='${PREFIX}' --with-mpfr='${PREFIX} '--with-headers=../newlib-'${NEWLIB_VER}'/newlib/libc/include --with-mpc='${PREFIX}
#GCC_OPTIONS='--target='${TARGET}' --prefix='${PREFIX}' --enable-interwork --enable-multilib --disable-nls --disable-shared --disable-threads --with-gcc --with-gnu-as --with-gnu-ld --with-dwarf2 --enable-languages=c,c++ --with-newlib --with-headers=../newlib-'${NEWLIB_VER}'/newlib/libc/include --disable-libssp --disable-libstdcxx-pch --disable-libmudflap --disable-libgomp --with-gmp='${PREFIX}' --with-mpfr='${PREFIX}' --with-mpc='${PREFIX}' -v'
GDB_OPTIONS='--target='${TARGET}' --prefix='${PREFIX}' --disable-nls'
NEWLIB_OPTIONS='--target='${TARGET}' --prefix='${PREFIX}' --enable-interwork --enable-multilib --disable-newlib-supplied-syscalls'
On affiche les paramètres :
#Display settings
echo "Prefix : "${PREFIX}
echo "binutils options : "${BINUTILS_OPTIONS}
echo "gcc options : "${GCC_OPTIONS}
echo "gdb options : "${GDB_OPTIONS}
echo "newlib options : "${NEWLIB_OPTIONS}
On test les sources de chaque composants, après téléchargement :
echo "Press Key - Downloading CCC from web"
test ! -f binutils-${BINUTILS_VER}.tar.bz2 && wget http://ftp.gnu.org/gnu/binutils/binutils-${BINUTILS_VER}.tar.bz2
test ! -f gcc-core-${GCC_VER}.tar.bz2 && wget http://ftp.gnu.org/gnu/gcc/gcc-${GCC_VER}/gcc-core-${GCC_VER}.tar.bz2
test ! -f gcc-g++-${GCC_VER}.tar.bz2 && wget http://ftp.gnu.org/gnu/gcc/gcc-${GCC_VER}/gcc-g++-${GCC_VER}.tar.bz2
test ! -f newlib-${NEWLIB_VER}.tar.gz && wget ftp://sources.redhat.com/pub/newlib/newlib-${NEWLIB_VER}.tar.gz
test ! -f gdb-${GDB_VER}.tar.bz2 && wget http://ftp.gnu.org/gnu/gdb/gdb-${GDB_VER}.tar.bz2
Avant la compilation on nettoie une éventuelle, précédente compilation:
echo "Press Key - Cleaning ..."
rm -rf binutils-${BINUTILS_VER} newlib-${NEWLIB_VER} gdb-${GDB_VER} ${TARGET} gcc-${GCC_VER}
rm -rf ${PREFIX}
Et on prépare :
mkdir ${PREFIX}
mkdir ${PREFIX}/bin
export PATH=${PATH}:${PREFIX}/bin
echo "Path : "${PATH}
On décompresse :
tar jxvf binutils-${BINUTILS_VER}.tar.bz2
tar jxvf gcc-core-${GCC_VER}.tar.bz2
tar jxvf gcc-g++-${GCC_VER}.tar.bz2
tar zxvf newlib-${NEWLIB_VER}.tar.gz
tar jxvf gdb-${GDB_VER}.tar.bz2
Et on compile :
echo "Press Key - Building of binutils !"
cd binutils-${BINUTILS_VER}
mkdir build
cd build
../configure ${BINUTILS_OPTIONS}
make
make install
cd ../..
echo "Press Key - Building of boot gcc !"
read -n 1 c #getchar
cd gcc-${GCC_VER}
mkdir build
cd build
#mkdir -p host-i686-pc-linux-gnu/fixincludes
../configure ${GCC_OPTIONS} #2>err.log
#mkdir -p libiberty libcpp fixincludes
echo "boot gcc make " > ../err.log
make all-gcc 2>> ../err.log
echo "install boot gcc " >> ../err.log
make install-gcc 2>> ../err.log
cd ../..
echo "Press Key - Building of newlib !"
read -n 1 c #getchar
cd newlib-${NEWLIB_VER}
mkdir build
cd build
../configure ${NEWLIB_OPTIONS}
make
make install
cd ../..
echo "Press Key - Building of full gcc"
read -n 1 c #getchar
cd gcc-${GCC_VER}/build
../configure ${GCC_OPTIONS} #2>err.log
echo "full gcc make " >> ../err.log
make all 2>> ../err.log
echo "full gcc make install" >> ../err.log
make install 2>> ../err.log
cd ../..
echo "Press Key - Building of gdb !"
read -n 1 c #getchar
cd gdb-${GDB_VER}
mkdir build
cd build
../configure ${GDB_OPTIONS}
make
make install
cd ../..
Lien vers le script complet arm-none-eabi.sh.
