[Lazarus] Cross compiling
Brad Campbell
brad at wasp.net.au
Sat Apr 3 10:40:33 CEST 2010
Alberto Narduzzi wrote:
> Patrick,
>
> I have quick-read the links, and I think the quickest and easiest way of
> doing it is to install fpc and Lazarus on a Windows box, and then
> recompile the same source code.
> As I have a virtual Windows machine (under VirtualBox) on my Linux box,
> I think I can give it a try.
Meh.. the quickest and easiest way is the one where you can type "make all" on your linux box and
produce all your different architecture binaries all in one stroke. I don't see ever how running a
virtual machine just to compile code for a single architecture should ever be called easy.
Read the docs, do a bit of fiddling and *boom* you have a workable cross compile environment. Trust
me, if I can do it, anyone can.
If you get the mingw-binutils installed you can try a couple of these :
I use this to build my windows compiler : (watch the line wrap)
cd ~/src/fpc
FPC=ppc386 make crossall crossinstall CPU_TARGET=i386 OS_TARGET=win32 CROSSBINDIR=/opt/cross/bin
BINUTILSPREFIX=i386-mingw- INSTALL_PREFIX=/opt/cross OPT="-gl -XX -CX"
.. and this to build the LCL for win32.
cd ~/src/lazarus
export LAZARUS_CONFIG_DIR=/home/brad/.lazarus
make OS_TARGET=win32 CPU_TARGET=i386 LCL_PLATFORM=win32 OPT="-gl -CX " all
I kinda cheat with lazarus in that I build it default (for GTK2) then I build the OSX/Win32 builds,
then I build it *again* for linux including the idepkg option.
My compiler, toolchain and binutils lives in /opt/cross. Modify to suit.
I don't build my applications with lazbuild, I use a custom makefile as I find it easier, but
whatever works.
All my applications are compiled for linux-i386, win32-i386, darwin-i386 & darwin-powerpc using a
single source tree and a single make file on one linux machine. It's much easier to maintain and I
don't have to fight with windows or its related baggage.
Brad
--
Dolphins are so intelligent that within a few weeks they can
train Americans to stand at the edge of the pool and throw them
fish.
More information about the Lazarus
mailing list