How to switch between Win32/64 code generation in Lazarus?
Asked Answered
E

4

7

I installed 64-bit Lazarus and want to generate 32-bit code. When I try to set Target OS to Win32 I get error message

Compiler "C:\Programs\lazarus\fpc\2.6.0\bin\x86_64-win64\fpc.exe" does not support target x86_64-win32

so I guess I need to download and install additional fpc compiler to generate Win32 code and somehow to switch between them in Lazarus IDE.

What is the right way to do it?

Eno answered 14/12, 2012 at 8:10 Comment(3)
This CodeTyphon thing insists on creating its own folder in disk C root - no, I will never install it.Eno
yes, installers are rather lame, but being programmer, perhaps you can edit few .bat files ? Or install it and then move to another folder.Fugere
Strange since fpc is the frontloader binary. Maybe a fpc <-> ppc386 host architecture mismatch.Unmoor
A
4

You need the cross-compiler or simply compile in a 64bit IDE (pragmatic approach).

CodeTyphon works.

Annadiane answered 14/12, 2012 at 15:15 Comment(0)
U
3

There is a quick and easy way to cross compile from Win32 to Win64 in Lazarus. I assume that you already have a copy of Lazarus installed on your 32 bit version of Windows.

  1. Download fpc-2.6.2.x86_64-win64.exe (or whichever version is the latest) from the Free Pascal page at SourceForge.

  2. Install, and when it asks for a directory, give it your Lazaus FPC directory and version sub-directory. e.g. C:\lazarus\fpc\2.6.2

  3. All done! :-)

In your Lazarus project, you can now go to Project Options -> Code Generation.

Set:

Target OS = Win64 Target CPU Family = x84_64

Click Ok, and recompile your project. You will now have a 64-bit exe (or dll).

You can switch back and forth between 32-bit compilation and 64-bit compilation any time.

Underbelly answered 30/8, 2013 at 11:31 Comment(0)
F
1

Cross compiling is not a feature that "just works" in the standard distribution (either Lazarus or FPC). You'll need to compile the cross compiler yourself, though some are provided but for a very limited host-target pair, namely:

  • i386-win32 to x86_64-win64
  • i386-win32 to arm-wince

After getting the cross compiler (and the cross compiled standard units) installed, you'll need to also cross compile any other 3rd party units you use. Fortunately, you don't need to do this if they are shipped as Lazarus packages, Lazarus will happily do the recompilation for you when you compile your project to the cross target.

Fortuity answered 15/12, 2012 at 14:44 Comment(0)
P
0

Currently Lazarus provides both, from the downloads page:

This folder contains the installer for the 64 bit version of Lazarus 2.2.2 This installation is only for 64 bit versions of Windows.

The default installer is: lazarus-2.2.2-fpc-3.2.2-win64.exe You should download this file, if you want to work on any Windows 64 bit version. The installers include FPC 3.2.2.2 and they include the Lazarus help files.

Add-On for building and debugging 32bit Windows applications: lazarus-2.2.2-fpc-3.2.2-cross-i386-win32-win64.exe This file can be installed as add-on to the 64 bit Lazarus IDE (on Systems with Windows 64 bit only), if you wish to develop for 32bit Windows too.

Parulis answered 6/1 at 16:36 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.