[Lazarus] Tutorial Compiling/installing FPC and Lazarus from Sources of SVN

Sven Barth pascaldragon at googlemail.com
Fri Jul 23 10:09:28 CEST 2010


Hi!

Am 22.07.2010 23:49, schrieb waldo kitty:
> in other words, from a w2k box, if i grab the sources for i386-win and
> the sources for i386-linux and the sources for i386-OS2 and run the full
> compilation process, will i truly end up with the compilers for linux
> and OS2 such that cross compiling is now just a click or two away???
>
> somehow, i don't think so... i may be wrong but no one has really been
> able to show an easy method of doing this :?

Every i386-win32 compiler is also an i386-linux and an i386-os2 compiler 
(and other i386 targets as well). But to compile an application for 
another system than the current one (e.g. win32 -> linux) you have some 
requirements:

1) You need the binutils for the target system (e.g. an ELF-linker for 
Linux if you're compiling from Windows)
2) You need to build the RTL for the target
In FPC src dir you do it like this:
make all OS_TARGET=linux CPU_TARGET=i386 
CROSSBINDIR=c:\your\dir\with\linux\binutils BINUTILSPREFIX=i386-linux-
The BINUTILSPREFIX is the part of the binary names of the binutils 
before the e.g. "ld" or "as". It's (as well as CROSSBINDIR) needed for 
the compiler to pick the correct binutils
You can then install the RTL into the same directory as your normal 
win32 RTL:
make crossinstall OS_TARGET=linux CPU_TARGET=i386 
INSTALL_PREFIX=c:\where\you\installed\i386-win32\
3) To compile a more complex program you also need the libraries that 
are used on the target system like "ld-linux", "libc", "libmysqlclient", 
"libgtk" etc.

Please note: if you cross compile from a i386 target excluding win32 to 
win32 you need neither step 1 (because FPC contains an internal linker) 
nor step 3 (because that's not needed on Windows platforms including 
Win64 and WinCE).

To compile a cross compiler for a different platform (e.g. arm) you need 
the following:
1) Binutils for your target platform
2) You need to compile with CPU_TARGET=arm and the appropiate system 
(e.g. OS_TARGET=wince or OS_TARGET=linux) the rest is like 2) above
3) same as above

Regards,
Sven




More information about the Lazarus mailing list