lazbuild and crosscompilation lazarus / 1-Linux ---------------------------------------------------------------------- tintinux · 2013-01-05 09:56 Hi I have not found a better place to ask about lazbuid and cross compilation. I'm running Lazarus 1.0.2 on Ubuntu 12.04 on a x64 machine lazbuild works fine when I run : Code: [Select]lazbuild gestinux.lpi -Br --build-mode=packaging Now, I would like to compile on the same machine for i386 linux. I tried this : Code: [Select]lazbuild gestinux.lpi -Br --build-mode=packaging --operating-system=linux --widgetset=gtk2 --cpu=i386 The compiler is changed to ppc386 (why ?), which  doesn't exist on my system, so it raises an error : Code: [Select]Error: ppc386 can't be executed, error message: Failed to execute "ppc386", error code: 127 TExternalToolList.Run Exception: Error: ppc386 can't be executed, error message: Failed to execute "ppc386", error code: 127 ERROR: tool reported error I tried to specify the compiler like this : Code: [Select]lazbuild gestinux.lpi -Br --build-mode=packaging --operating-system=linux --widgetset=gtk2 --cpu=i386  --language=en --compiler=ppcx64 I do not understand why it compiles all the packages (CompilerFilename="ppcx64"), but raises an error for the project (Error: invalid compiler: file "ppcx64" does not exist = wrong !). Code: [Select]... [TExternalToolList.Run] CmdLine="/usr/bin/ppcx64  -MObjFPC -Scgi -O1 -Pi386 -g -gl -vewnhi -l -Fu/home/mrodot/.lazarus/lib/units/i386-linux/gtk2 -Fu/home/mrodot/.lazarus/lib/LCLBase/units/i386-linux -Fu/home/mrodot/.lazarus/lib/LazUtils/lib/i386-linux -Fu/home/mrodot/.lazarus/lib/units/i386-linux -Fu/usr/share/lazarus/1.0.2/components/sdf/ -FU/home/mrodot/.lazarus/lib/SDFLaz/lib/i386-linux/gtk2 -dLCL -dLCLgtk2 sdflaz.pas" WorkDir="/usr/share/lazarus/1.0.2/components/sdf/" Hint: Start of reading config file /etc/fpc.cfg Hint: End of reading config file /etc/fpc.cfg Free Pascal Compiler version 2.6.0 [2012/08/24] for x86_64 Copyright (c) 1993-2011 by Florian Klaempfl and others Target OS: Linux for x86-64 Compiling sdflaz.pas sdflaz.pas(10,23) Hint: Unit "SdfData" not used in SDFLaz 21 lines compiled, 0.1 sec 3 hint(s) issued "Compiling package SDFLaz 0.1.1" completed TCompiler.Compile WorkingDir="/home/mrodot/Documents/Mrit/Technique/La zarus/gestinux/trunk/" CompilerFilename="ppcx64" CompilerParams=" -MObjFPC -Scahi -CX -O3 -Tlinux -Pi386 -Xs -XX -vew -l -Fl/usr/share/lazarus/1.0.2/lcl/units/i386-linux -Fl/opt/gnome/lib -Fuutil -Fu/usr/share/lazarus/1.0.2/lcl/units/i386-linux -Fu../../../../../../.lazarus/lib/SDFLaz/lib/i386-linux/gtk2 -Fuutil/lib/i386-linux -Fu../../Tiers/Zeos/ZEOSDBO-7.0.3- stable/packages/lazarus/lib/i386-linux -Fu../../../../../../.lazarus/lib/lazreportpdfexport/lib/i386-linux -Fu../../Tiers/powerpdf/powerpdf_0.9.9_20121104/lib/i386-linux -Fu../../../../../../.lazarus/lib/lazreport/lib/i386-linux -Fu../../../../../../.lazarus/lib/Printer4Lazarus/lib/i386-linux/gtk2 -Fu../../../../../../.lazarus/lib/SynEdit/units/i386-linux/gtk2 -Fu../../../../../../.lazarus/lib/IDEIntf/units/i386-linux/gtk2 -Fu../../../../../../.lazarus/lib/units/i386-linux/gtk2 -Fu../../../../../../.lazarus/lib/LCLBase/units/i386-linux -Fu../../../../../../.lazarus/lib/LazUtils/lib/i386-linux -Fu../../../../../../.lazarus/lib/units/i386-linux -Fu. -dLCL -dLCLgtk2 gestinux.lpr" TCompiler.WriteError Error: invalid compiler: file "ppcx64" does not exist Error: invalid compiler: file "ppcx64" does not exist ERROR: failed compiling of project /home/mrodot/Documents/Mrit/Techniq ue/Lazarus/gestinux/trunk/gestinux.lpi I don't see anything about that in fpc.cfg What is the problem ? Do I need another compiler for this target or how should I do ? Thanks ---------------------------------------------------------------------- Leledumbo · 2013-01-05 11:58 QuoteThe compiler is changed to ppc386 (why ?)Because the cpu target (i386) differs from cpu host (x64 you say?). Still, it's wrong, it should call ppcross386 instead. QuoteI tried to specify the compiler like this This is even crazier, what's the point of compiling for i386 using x64 compiler? The even more crazier part is if it can compile without error... ---------------------------------------------------------------------- tintinux · 2013-01-05 13:35 Thanks for your reply. QuoteStill, it's wrong, it should call ppcross386 instead1) what is "It" ?   You mean that I should put --compiler=ppcross386, or you mean there is something wrong elsewhere ? 2) I don't find this ppcross386, how can I obtain it  ? QuoteThis is even crazier, what's the point of compiling for i386 using x64 compiler? So, we must use a different compiler for each target platform ? This is definitely not obvious : why is there a cpu parameter, if each compiler can be used for only one cpu ? Is there some more help about this ? Where can we find the compiler to use for each cpu or target ? Regards, Tintinux ---------------------------------------------------------------------- Leledumbo · 2013-01-05 13:54 Quote1) what is "It" ?The thing that lazbuild does: calling the compiler. QuoteYou mean that I should put --compiler=ppcross386, or you mean there is something wrong elsewhere ?lazbuild doesn't call the correct compiler. Quote2) I don't find this ppcross386, how can I obtain it  ?You have to build the cross compiler, this has been asked many times in the forum and we have dedicated wiki article for this, marco even make a pdf named buildfaq to explain the process in depth. QuoteSo, we must use a different compiler for each target platform ?FPC has one compiler binary for each architecture: ppcx64, ppc386, ppcarm, etc. And if the compilation is done for a different architecture, the name will have 'ross' inserted after ppc: ppcrossx64, ppcross386, ppcrossarm, etc. QuoteThis is definitely not obvious : why is there a cpu parameter, if each compiler can be used for only one cpu ?Obvious, but not quite easily understood for those new in this field. The parameter is used to determine which ppcXXX to call, this also applies to the compiler driver: fpc (with it's -P parameter). QuoteIs there some more help about this ?As I said above: search the forum, read the wiki and marco's buildfaq. QuoteWhere can we find the compiler to use for each cpu or target ?Nowhere officially except for these 3: i386-win32 -> x86_64-win64i386-win32 -> arm-wincedon't ask why because I don't know, but perhaps due to missing maintainer and too many combinations yet everyone has their own cross target needs. You have to build the cross compiler from source by yourself, specifying your exact target. ---------------------------------------------------------------------- tintinux · 2013-01-05 16:04 Hi Thanks for the more detailed explanations. Quoteexcept for these 3:     i386-win32 -> x86_64-win64     i386-win32 -> arm-wince don't ask why I would just ask what is the third one  I'll try to find the documents and my way, but it seems that cross compilation is not really possible on linux. Regards Tintinux ---------------------------------------------------------------------- Leledumbo · 2013-01-05 16:09 QuoteI would just ask what is the third oneWindows CE on ARM architecture Quotebut it seems that cross compilation is not really possible on linuxFPC is developed ON linux, it gets linux first before win32I have 5 cross targets on my i386-linux machine: arm-linux, i386-win32, jvm- android, jvm-java, x86_64-win64So you have to really adjust your statement about "not really possible on linux" ---------------------------------------------------------------------- tintinux · 2013-01-05 17:08 Hi Yes, I adjust : it might be possible for heroes like you I understand nearly nothing to marco's paper, excepted that all this is definitely out of my skills. We don't need to read all Shakespeare theatre to understand what is a king. This doesn't mean that Marco (like Shakespeare) are not useful and valuable. May be, some day, you, or another, will find time to explain how we can cross compile from and to most popular distributions. We just need to know the exact command lines and names. For now, I will continue with Lazarus installed on 4 machines, and compile on each one. Regards ---------------------------------------------------------------------- Leledumbo · 2013-01-05 17:22 QuoteYes, I adjust : it might be possible for heroes like youNo need to be heroes, just a bit of patience in learning I use FPC since 1.0.X year, touches its cross compilation feature around 2.2.X (i386-win32 -> i386-linux only), with failures here and there, lots of reading and understanding, until finally gets everything in mind and code something (below) to ease my needs in 2.6.X (2.7.X actually, I stop using release version since 2.3.X) time. QuoteMay be, some day, you, or another, will find time to explain how we can cross compile from and to most popular distributions. We just need to know the exact command lines and names.I've made a little script to help building cross compiler from source: http://forum.lazarus.freepascal.org/index.php/topic,18359.30.html ---------------------------------------------------------------------- Fred vS · 2013-01-05 20:28 QuoteI have not found a better place to ask about lazbuid and cross compilation. Why not use simply CodeTyphon ? http://www.pilotlogic.com/sitejoom/index.php/codetyphon/codetyphon- download ---------------------------------------------------------------------- Fred vS · 2013-01-05 20:30 Quotei386-win32 -> x86_64-win64 CodeTyphon does it... From CodeTyphon team : QuoteWe add Win32-To-Win64 Cross-Build ability to CodeTyphon 1) unzip win32-x86_64-win64.zip to your C:\codetyphon\bin\bincross folder 2) Build "x86_64-win64" cross element from CodeTyphon Center 3) Open Lazarus and start programming... Here link to zip file : http://www.pilotlogic.com/sitejoom/media/kunena/attachments/63/win32- x86_64-win64.zip