[Lazarus] Cross-compiling Linux project to Windows from inside IDE

Mattias Gärtner nc-gaertnma at netcologne.de
Mon Nov 9 12:57:39 CET 2009


Zitat von Graeme Geldenhuys <graeme at mastermaths.co.za>:

> Hi,
>
> I followed the instructions on the Wiki to create a cross-compiler for
> Windows.
>
>   http://wiki.lazarus.freepascal.org/Cross_compiling#To_Windows
>
> My current system is Ubuntu 64bit with FPC 64bit. I'm cross-compiling my
> projects to Win32 from inside the IDE.
>
> I have managed to successfully cross-compile my projects, but the
> process is definitely not simple or quick. Is there some better way of
> doing this from inside the IDE?
>
> Currently I have to following these steps:
>
> 1)  Manually created a cross-compile script for fpGUI Toolkit, because
> Lazarus Packages don't seem to support different files for various
> platforms. So I have two .lpk files for Lazarus. One for Linux and one
> for Windows.

It should be possible.
Have unchecked 'use unit'?
What error do you get?


> 2)  Due to the above problem, I can't include the fpgui_toolkit.lpk
> packages as a dependency to my project when I cross-compile. So I have
> to remove the dependency first (By thew trunk Lazarus crashes with AV
> when I remove it. On restarting the IDE, I can remove it successfully).

Can you reproduce the problem?
Can you send me a backtrace?


> 3) Environment Options: Change Compiler path and FPC Source Path.

Or use 'fpc' as compiler.
Why change FPC source path?


> 4) In my Project Compiler Options dialog, go to Code tab and change
> target platform and CPU to 'Windows 32' and 'i386'. Remember, by current
> setup is Linux with 64bit FPC.
>
> 5) Then due to issue (1), I have to manually add a -Fu<path> in the
> Project Compiler Options dialog - Other tab.

(1) should not exist, so (5) is not needed.


> 6) If fpGUI code changed, manually run the cross-compile scrip.

same: not needed, when normal package is used


> 7) Click Compile in Lazarus.

yes, that is needed.


> Finally I have a Windows 32bit executable.
>
> Now if I want to continue with Linux + 64bit development in my project,
> I have to undo all the steps above before I can recompile. This process
> is extremely tedious.
>
> Is there ANY better or faster way of doing this?

Help us to fix the above bug.

> My next step is to
> simply create a cross-compile script for my project as this will be MUCH
> quicker that the process above.


Mattias






More information about the Lazarus mailing list