Installation FPC Cross Compiler for ARM ( Kubuntu 9.04 Jaunty Jackalope)


+ install package fpc     ( currently 2.2.2 )            
apt-get install fpc

+ download the toolchain from
http://free-electrons.com/labs/tools/arm-unknown-linux-uclibc-gcc-4.3.2.tar.bz2
and uncompress it as root in /.
Then, add the cross-compiler directory to the PATH
export PATH=/usr/local/xtools/arm­unknown­linux­-uclibcgnueabi/bin:$PATH

+ install subversion
apt-get install subversion

+ download a recent version of fpc
svn checkout http://svn.freepascal.org/svn/fpc/tags/release_2_4_0_rc1 ./fpc240

+ compile the compiler
patch sdl mixer to avoid error, so no sdl lib is included
cd ./fpc240
vi packages/sdl/src/sdl_mixer.pas
 
 change lines starting at 450
 
       {$IFNDEF DARWIN}
       5 : ( mp3 : PSMPEG );
       {$ENDIF}
 
 with these lines, the sdl lib is removed !

       {$IFNDEF DARWIN}
       {$IFNDEF no_smpeg}
       5 : ( mp3 : PSMPEG );
       {$ENDIF}
       {$ENDIF}
 

make clean

make crosszipinstall CPU_TARGET=arm CROSSOPT='-CfFPA -dUSB92 -darm -dno_smpeg -dFPC_ARMEL -O- -gl' CROSSBINDIR=/usr/local/xtools/arm-unknown-linux-uclibc/bin/ BINUTILSPREFIX=arm-unknown-linux-uclibc- OPT="-XLAdl=c"


+ Installation of the binaries
cd /usr/local/
tar -xzvf /home/ubuntu/fpc240/fpc-2.4.0rc1.arm-linux.tar.gz
cd /usr/local/bin
ln -s /usr/local/lib/fpc/2.4.0/ppcrossarm ppcrossarm

+ go to
/usr/local/xtools/arm-unknown-linux-uclibc/arm-unknown-linux-uclibc/sys-root/usr/lib/
and softlink all libraries to have a link like libdl.so instead of libdl.so.0

Compiling programs:

 /usr/local/bin/ppcrossarm -CfFPA  -dUSB92 -CaARMEB -CpARMV5 -darm -dFPC_ARMEL  -gl -Fu../webserver -Fu../PhysMach -Fu../divLibs/pwu-1.6.0.2-src/main/ -XP/usr/local/xtools/arm-unknown-linux-uclibc/arm-unknown-linux-uclibc/bin/ -XR/usr/local/xtools/arm-unknown-linux-uclibc/arm-unknown-linux-uclibc/ -Fl/usr/local/xtools/arm-unknown-linux-uclibc/arm-unknown-linux-uclibc/sys-root/usr/lib/  DeviceServer.pas

[REFERENCES]
http://www.seban.de/index.php/fpc-einrichten.html
http://free-electrons.com/doc/kernel-cross-compiling-lab.pdf
http://svn.freepascal.org/cgi-bin/viewvc.cgi/tags/

[THANKS]
Thanks to all people who work hard on free software and therefor made
this possible.
I used the knowledge compiled on the websites I mention under [REFERENCES].
All I did was using this knowledge and compile this readme to allow others
to do the same.
A special thank go to the freepascal mailing list and Jonas and Dariusz for
their support.
(c) 2009 by Hartmut Eilers