[Lazarus] Cross compiling

Duncan Parsons D.Parsons at seamsltd.com
Tue Apr 6 10:54:23 CEST 2010


On 03 April 2010 09:41, Brad Campbell wrote:

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


I've always liked this idea, but working primarily in windows limits the
options, and I find this somewhat annoying! My targets would be win32/64
and OSX-Carbon (+Cocoa when sufficiently mature).

It looks like I might be able to do this from OSX, but win is my primary
platform. I understand the reasoning, and I guess it's just one of those
things..

One day I'll sort it out!




More information about the Lazarus mailing list