Recent

Author Topic: Installing 32bit cross compiler  (Read 2102 times)

440bx

  • Hero Member
  • *****
  • Posts: 4731
Installing 32bit cross compiler
« on: March 03, 2024, 02:31:19 am »
Hello,

I've accumulated a number of Lazarus installations.  I am currently using the "fixes" branch of both, FPC and Lazarus.

I wanted to install the "fixes" version of the Win32 cross compiler.  When I went to sourceforge, there is no version 3.1 (fixes) for the 32bit cross compiler. 

My first question is: what version of the Win32 cross compiler should I install ?

My second question is: since I have multiple Lazarus/FPC installations on that machine, how do I ensure that the Win32 cross compiler installation applies _only_ to the "fixes" (v3.1) installation and does not in any way affect the other installations ?

Thank you for your help.

Just in case it may be helpful, attached is a screenshot of the "About" Lazarus/FPC installation I want to enable 32 bit compiling.

(FPC v3.0.4 and Lazarus 1.8.2) or (FPC v3.2.2 and Lazarus v3.2) on Windows 7 SP1 64bit.

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 11938
  • FPC developer.
Re: Installing 32bit cross compiler
« Reply #1 on: March 03, 2024, 12:10:56 pm »
There is a win32->win64 crosscompiler, not a win64->win32 crosscompiler.

Reasons for that, as so often lie in the fact that win64 doesn't allow x87. Work on softfloat to fix that is years under way, but to my best knowledge not operational.

440bx

  • Hero Member
  • *****
  • Posts: 4731
Re: Installing 32bit cross compiler
« Reply #2 on: March 03, 2024, 12:28:38 pm »
There is a win32->win64 crosscompiler, not a win64->win32 crosscompiler.

Reasons for that, as so often lie in the fact that win64 doesn't allow x87. Work on softfloat to fix that is years under way, but to my best knowledge not operational.
Now I realize I should have been asking for a different thing.

I have the 64bit version of Lazarus "fixes" (v3.1) installed which has an FPC compiler installed that produces 64bit executables.  What I'd like is to have that 64bit Lazarus installation also be able to produce 32bit executables.  Is there something (some version of the FPC compiler) I can install to enable the 64bit version of Lazarus to produce 32bit executables ?

(FPC v3.0.4 and Lazarus 1.8.2) or (FPC v3.2.2 and Lazarus v3.2) on Windows 7 SP1 64bit.

DonAlfredo

  • Hero Member
  • *****
  • Posts: 1781
Re: Installing 32bit cross compiler
« Reply #3 on: March 03, 2024, 12:45:40 pm »
This should be possible if you use -dFPC_SOFT_FPUX80 when (re)building the compilers.

440bx

  • Hero Member
  • *****
  • Posts: 4731
Re: Installing 32bit cross compiler
« Reply #4 on: March 03, 2024, 12:56:02 pm »
This should be possible if you use -dFPC_SOFT_FPUX80 when (re)building the compilers.
My understanding of the details of Lazarus and FPC installations is rather deficient.

Currently, I believe my 64bit Lazarus installation does not have access to an FPC compiler that produces 32bit executables.  I'm guessing that to enable that installation to produce 32bit executable I'd have to install a version of FPC that produces 32bit executables and somehow inform the 64bit installation of Lazarus to use that installation of FPC to produce 32bit executables. 

Is my understanding correct and if so, how do I install another compiler (one that produces 32bit executables) for that Lazarus installation to use ?

Thank you for your help.
(FPC v3.0.4 and Lazarus 1.8.2) or (FPC v3.2.2 and Lazarus v3.2) on Windows 7 SP1 64bit.

LV

  • Full Member
  • ***
  • Posts: 153
Re: Installing 32bit cross compiler
« Reply #5 on: March 03, 2024, 01:21:17 pm »
I have the 64bit version of Lazarus (v2.2.6) installed which has an FPC compiler installed that produces 64bit executables and Add-On for building and debugging 32bit Windows applications:lazarus-2.2.6-fpc-3.2.2-cross-i386-win32-win64.exe.

Then (see picture) -> Lazarus (v2.2.6) produces 32bit executables

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 10552
  • Debugger - SynEdit - and more
    • wiki
Re: Installing 32bit cross compiler
« Reply #6 on: March 03, 2024, 01:30:44 pm »
The cross compiler (64 to 32 for win) is actually a renamed normal 32bit compiler.

Since Window64 executes 32 bit exes, the compiler to generate the 32bit exe does not have to be 64 bit. It all comes down to rename the ppc so fpc.exe can find it, when called with cross compile params.

So if you need a 3.3.1 "cross" compiler => get the normal 32 bit compiler, rename the ppc, and copy it into the correct location (and copy the ppu into the correct location).

If you already have an installation created by the win-installer, then you can check the directory layout there.

440bx

  • Hero Member
  • *****
  • Posts: 4731
Re: Installing 32bit cross compiler
« Reply #7 on: March 03, 2024, 01:44:11 pm »
Thank you LV and Martin.

I think I understood what I need to do.  I'm going to "play" with it a bit.
(FPC v3.0.4 and Lazarus 1.8.2) or (FPC v3.2.2 and Lazarus v3.2) on Windows 7 SP1 64bit.

tetrastes

  • Hero Member
  • *****
  • Posts: 592
Re: Installing 32bit cross compiler
« Reply #8 on: March 03, 2024, 04:28:53 pm »
The cross compiler (64 to 32 for win) is actually a renamed normal 32bit compiler.

Since Window64 executes 32 bit exes, the compiler to generate the 32bit exe does not have to be 64 bit. It all comes down to rename the ppc so fpc.exe can find it, when called with cross compile params.

So if you need a 3.3.1 "cross" compiler => get the normal 32 bit compiler, rename the ppc, and copy it into the correct location (and copy the ppu into the correct location).

If you already have an installation created by the win-installer, then you can check the directory layout there.
You need not to rename it. In my C:\lazarus\fpc\3.2.2\bin\x86_64-win64 I have ppcx64.exe and ppc386.exe.

PascalDragon

  • Hero Member
  • *****
  • Posts: 5755
  • Compiler Developer
Re: Installing 32bit cross compiler
« Reply #9 on: March 04, 2024, 09:16:32 pm »
This should be possible if you use -dFPC_SOFT_FPUX80 when (re)building the compilers.

It allows for compilation, but NOT for correct code, because the 64-bit compiler will evaluate compile time constants using Double precision, while the 32-bit compiler will use Extended precision. Thus it is currently not recommended by us to use that directive.

 

TinyPortal © 2005-2018