Recent

Author Topic: [INFO] Lazarus Installation Guide to Cross-Compile Windows 32/64-bit  (Read 14340 times)

JimD

  • Jr. Member
  • **
  • Posts: 62
Summary:
  • I'm new to Lazarus and FPC and I am loving it!
  • I have read many posts in many places to figure this out.
  • This post is to help others with current information.

Lazarus Installation Guide to Cross-Compile Windows 32/64-bit
-----------------------------------------------------------------------

Download the installers from sourceforge.net  (click on the Files tab):
   https://sourceforge.net/projects/lazarus/

The installers include FPC and the Lazarus help files:
   Lazarus 32-bit
      lazarus-1.8.2-fpc-3.0.4-win32.exe
      lazarus-1.8.2-fpc-3.0.4-cross-x86_64-win64-win32.exe
   Lazarus 64-bit
      lazarus-1.8.2-fpc-3.0.4-win64.exe
      lazarus-1.8.2-fpc-3.0.4-cross-i386-win32-win64.exe

To install Lazarus 32-bit, and cross-compile a Windows 64-bit exe:
   1. Install the win32.exe
   2. Install the cross-x86_64-win64-win32.exe in the same folder

To install Lazarus 64-bit, and cross-compile a Windows 32-bit exe:
   1. Install the win64.exe
   2. Install the cross-i386-win32-win64.exe in the same folder

The following assumes Lazarus 64-bit with cross-i386-win32-win64
---------------------------------------------------------------------------

To cross-compile 32-bit or 64-bit without creating Build Modes:
   Project, Options, Compiler Options, Config and Target:
      Target OS             =Default=Win64  or Win32 for 32-bit
      Target CPU family =Default=x86_64 or i386  for 32-bit
      Target processor   =Default
   Press OK to exit Project Options
   Build and run the project
   Use Windows Task Manager, Details tab, to see if Project exe is 32/64-bit
   
To Configure Build Modes:
   Project, Options, Compiler Options, Config and Target:
      Check 'Build Modes', then press the [...] button
         Press [Create Debug and Release Modes] button
         Press OK
         
   Create a Debug 32-bit Build Mode:
      Lazarus menu: Project, Options, Compiler Options, Config and Target
      Select Build Mode = Debug
      Press the Build Modes [...] button
         Click to select Debug on the list
         Press the [ + ] button to add a new build mode
         Rename to 'Debug 32-bit', press OK
      Set Target Platform to 32-bit:
         Target OS            =Win32
         Target CPU family =i386
         Target processor   =Default
      Press OK to exit Project Options and save Build Mode 'Debug 32-bit'
      
   Create a Debug 64-bit Release Mode:
      Lazarus menu: Project, Options, Compiler Options, Config and Target
      Select Build Mode = Release
      Press the Build Modes [...] button
         Click to select Release on the list
         Press the [ + ] button to add a new build mode
         Rename to 'Release 32-bit', press OK
      Set Target Platform to 32-bit:
         Target OS             =Win32
         Target CPU family =i386
         Target processor   =Default
      Press OK to exit Project Options and save Build Mode 'Release 32-bit'      
   Build and run the project
   Use Windows Task Manager, Details tab, to see if Project exe is 32/64-bit

To use Build Modes:
   Lazarus IDE Menu: Change Build Mode dropdown (left of Run button)
   Build and run the project
   Use Windows Task Manager, Details tab, to see if Project exe is 32/64-bit

keleven

  • Newbie
  • Posts: 4
Re: [INFO] Lazarus Installation Guide to Cross-Compile Windows 32/64-bit
« Reply #1 on: February 10, 2019, 10:34:49 pm »
Thanks for that, worked a treat.   :)

I have tried before and got confused, I ended up running two separate installations.

valdir.marcos

  • Hero Member
  • *****
  • Posts: 1106
Re: [INFO] Lazarus Installation Guide to Cross-Compile Windows 32/64-bit
« Reply #2 on: February 11, 2019, 04:07:48 am »
Summary:
  • I'm new to Lazarus and FPC and I am loving it!
  • I have read many posts in many places to figure this out.
  • This post is to help others with current information.

Lazarus Installation Guide to Cross-Compile Windows 32/64-bit
-----------------------------------------------------------------------

Download the installers from sourceforge.net  (click on the Files tab):
   https://sourceforge.net/projects/lazarus/

The installers include FPC and the Lazarus help files:
   Lazarus 32-bit
      lazarus-1.8.2-fpc-3.0.4-win32.exe
      lazarus-1.8.2-fpc-3.0.4-cross-x86_64-win64-win32.exe
   Lazarus 64-bit
      lazarus-1.8.2-fpc-3.0.4-win64.exe
      lazarus-1.8.2-fpc-3.0.4-cross-i386-win32-win64.exe

To install Lazarus 32-bit, and cross-compile a Windows 64-bit exe:
   1. Install the win32.exe
   2. Install the cross-x86_64-win64-win32.exe in the same folder

To install Lazarus 64-bit, and cross-compile a Windows 32-bit exe:
   1. Install the win64.exe
   2. Install the cross-i386-win32-win64.exe in the same folder

The following assumes Lazarus 64-bit with cross-i386-win32-win64
---------------------------------------------------------------------------

To cross-compile 32-bit or 64-bit without creating Build Modes:
   Project, Options, Compiler Options, Config and Target:
      Target OS             =Default=Win64  or Win32 for 32-bit
      Target CPU family =Default=x86_64 or i386  for 32-bit
      Target processor   =Default
   Press OK to exit Project Options
   Build and run the project
   Use Windows Task Manager, Details tab, to see if Project exe is 32/64-bit
   
To Configure Build Modes:
   Project, Options, Compiler Options, Config and Target:
      Check 'Build Modes', then press the [...] button
         Press [Create Debug and Release Modes] button
         Press OK
         
   Create a Debug 32-bit Build Mode:
      Lazarus menu: Project, Options, Compiler Options, Config and Target
      Select Build Mode = Debug
      Press the Build Modes [...] button
         Click to select Debug on the list
         Press the [ + ] button to add a new build mode
         Rename to 'Debug 32-bit', press OK
      Set Target Platform to 32-bit:
         Target OS            =Win32
         Target CPU family =i386
         Target processor   =Default
      Press OK to exit Project Options and save Build Mode 'Debug 32-bit'
      
   Create a Debug 64-bit Release Mode:
      Lazarus menu: Project, Options, Compiler Options, Config and Target
      Select Build Mode = Release
      Press the Build Modes [...] button
         Click to select Release on the list
         Press the [ + ] button to add a new build mode
         Rename to 'Release 32-bit', press OK
      Set Target Platform to 32-bit:
         Target OS             =Win32
         Target CPU family =i386
         Target processor   =Default
      Press OK to exit Project Options and save Build Mode 'Release 32-bit'      
   Build and run the project
   Use Windows Task Manager, Details tab, to see if Project exe is 32/64-bit

To use Build Modes:
   Lazarus IDE Menu: Change Build Mode dropdown (left of Run button)
   Build and run the project
   Use Windows Task Manager, Details tab, to see if Project exe is 32/64-bit
Thanks.

Could you improve the wiki?
http://wiki.freepascal.org/Cross_compiling#From_win32_to_win64
http://wiki.freepascal.org/Cross_compiling#From_win64_to_win32

Handoko

  • Hero Member
  • *****
  • Posts: 5131
  • My goal: build my own game engine using Lazarus
Re: [INFO] Lazarus Installation Guide to Cross-Compile Windows 32/64-bit
« Reply #3 on: February 11, 2019, 05:42:01 am »
Great !

dbannon

  • Hero Member
  • *****
  • Posts: 2786
    • tomboy-ng, a rewrite of the classic Tomboy
Re: [INFO] Lazarus Installation Guide to Cross-Compile Windows 32/64-bit
« Reply #4 on: February 11, 2019, 08:30:04 am »
......
Could you improve the wiki?
http://wiki.freepascal.org/Cross_compiling#From_win32_to_win64
http://wiki.freepascal.org/Cross_compiling#From_win64_to_win32

+1 from me !  Its a bit of work jasc2v8 but not hard. And actually writing it out, a bit formatted, will help you understand it even better !

Its great to see things like this posted in the forum but most new users poke around in the wiki first and we have a lot of dated stuff in the wiki....

Davo 
Lazarus 3, Linux (and reluctantly Win10/11, OSX Monterey)
My Project - https://github.com/tomboy-notes/tomboy-ng and my github - https://github.com/davidbannon

JimD

  • Jr. Member
  • **
  • Posts: 62
OK, I updated the wiki, thank you.

kqha

  • New Member
  • *
  • Posts: 23
Re: [INFO] Lazarus Installation Guide to Cross-Compile Windows 32/64-bit
« Reply #6 on: October 20, 2020, 02:31:00 pm »
Tried the step-by-step on my existing Win64 Lazarus 2.0.6+FPC 3.0.4:
  • Downloaded lazarus-2.0.6-fpc-3.0.4-cross-x86_64-win64-win32.exe
  • Install it to my existing lazarus dir
  • Run lazarus

to test:
  • Create a new project
  • Project Options - Config and Target: Target OS = Win32, Target CPU family = i386
  • Run project

I got an error says Compiler "D:\Apps\lazarus\fpc\3.0.4\bin\x86_64-win64\fpc.exe" does not support target i386-win32 after trying to compile and/or when closing the Project Options window. In addition, when I tried to compile the project I got an error says
Code: Pascal  [Select][+][-]
  1. Error: ppc386.exe can't be executed, error message: Failed to execute ""ppc386.exe"  -Twin32 -MObjFPC -Scghi -O1 -g -gl -l -vewnhibq -FuD:\Apps\lazarus\packager\registration\ -FUD:\Apps\lazarus\packager\units\i386-win32\ fcllaz.pas

Any idea what went wrong?

Handoko

  • Hero Member
  • *****
  • Posts: 5131
  • My goal: build my own game engine using Lazarus
Re: [INFO] Lazarus Installation Guide to Cross-Compile Windows 32/64-bit
« Reply #7 on: October 20, 2020, 02:47:48 pm »
Do you use 64-bit Windows and 64-bit Lazarus?

If yes, you should download the ....-cross-i386-win32-win64.exe.

kqha

  • New Member
  • *
  • Posts: 23
Re: [INFO] Lazarus Installation Guide to Cross-Compile Windows 32/64-bit
« Reply #8 on: October 20, 2020, 03:11:11 pm »
Do you use 64-bit Windows and 64-bit Lazarus?

If yes, you should download the ....-cross-i386-win32-win64.exe.

Damn, I'm getting old. How can I missed something like that  :-[ Tried the correct ver, now run just fine. Thanks  :)

 

TinyPortal © 2005-2018