[Lazarus] Cross compiler

Sven Barth pascaldragon at googlemail.com
Wed Jun 12 16:06:48 CEST 2013


Am 12.06.2013 15:22, schrieb Antonio Fortuny:
>
> Le 27/05/2013 19:28, Sven Barth a écrit :
>> Am 27.05.2013 14:51 schrieb "Antonio Fortuny" 
>> <a.fortuny at sitasoftware.lu>:
>> > Because I develop for Win32, Win64, WinCE (win32 based) and Linux 
>> x86_64, to have one signle development platform would be a charm. I 
>> think this is still a dream and there is a long way.
>>
>> In this situation the best solution would be to use Linux x86_64 as 
>> the base system. Win32 and Win64 cross compilers can be easily built 
>> using
>>
> Assume FPC is installed in
> /usr/lib64/fpc/2.6.2
> sources are in
> /usr/share/fpcsrc/2.6.2
> and lazarus is in
> /usr/lib64/lazarus with some other tings in ~/.lazarus
>> make crossall crossinstall OS_TARGET=win32 CPU_TARGET=i386 
>> INSTALL_PREFIX=/wherever/you/have/your/fpc/installed
>> make crossall crossinstall OS_TARGET=win64 CPU_TARGET=x86_64 
>> INSTALL_PREFIX=/wherever/you/have/your/fpc/installed
> fpc/installed : /usr/lib64/fpc/2.6.2 or /usr/share/fpcsrc/2.6.2
> WHERE should I place the current directory to run these commands ?
> cd ???
How I love those directory problems with different Linux distributions -.-
Ok, with that lib64 directory things are not so nice, but I have a 
solution for that as well.
To not interfere with your package manager I'd suggest you to install a 
complete freshly build compiler in /usr/local (ensure that the directory 
exists):

cd /usr/share/fpcsrc/2.6.2
make all
sudo make install INSTALL_PREFIX=/usr/local
make crossall OS_TARGET=win32 CPU_TARGET=i386
sudo make crossinstall OS_TARGET=win32 CPU_TARGET=i386 
INSTALL_PREFIX=/usr/local
make crossall OS_TARGET=win64 CPU_TARGET=x86_64
sudo make crossinstall OS_TARGET=win64 CPU_TARGET=x86_64 
INSTALL_PREFIX=/usr/local

To use the compiler you'll then need to modify your ~/.fpc.cfg and 
adjust all paths that previously pointed to /usr/lib64/fpc/2.6.2/... to 
the new directory.

>>
>> For WinCE you'll need cross binutils from Linux to WinCE and then you 
>> can build the cross compiler using this:
>>
>> make crossall crossinstall OS_TARGET=wince CPU_TARGET=arm 
>> CROSSBINDIR=/path/to/binutils BINUTILSPREFIX=arm-wince- 
>> INSTALL_PREFIX=/wherever/you/have/your/fpc/installed
> same question
> cd ????
Please split this one similar to above and set CROSSBINDIR and 
BINUTILSPREFIX accordingly.
>
> What will those commands produce ?
> The cross-compiler only ?
The first command after the "cd" will produce a native Linux compiler 
(including RTL, FCL, etc) for your current platform (I assume x86_64), 
then the Win32 one (compiler, RTL, FCL, etc.) and the Win64 one 
(compiler, RTL, FCL, etc.)
>
> This makes something for FPC. What about Lazarus ?
Simply point Lazarus to /usr/local/bin/fpc instead of /usr/bin/fpc and 
it *should* work. Then you just need to set your target options 
correctly and you should be good to go.

Regards,
Sven




More information about the Lazarus mailing list