Recent

Author Topic: [SOLVED] 64 bit/32 bit problem  (Read 8773 times)

Badger

  • Full Member
  • ***
  • Posts: 144
[SOLVED] 64 bit/32 bit problem
« on: January 09, 2021, 07:59:53 am »
My computer is 64 bit operating system and x64 bit-based processor running Windows 10 Home.  For my most recent programs the Compiler Options/Target platform options are all set to Default.  Naturally, my programs run as 64 bit exe's.
My friend needs to run the program but has a pc running Windows 10 Pro. but the OS is 32 bit with x64-based processor.  Before establishing his OS we got a message something like - File won't run on this computer.
I do realise that 64 bit exe's won't run on 32 bit systems.
A couple of questions:-
1 - Can I compile using Target platform options Win32/i386/ etc or do I have to install and use the 32 bit lazarus.
2 - So that other people can use the program, should I provide a 32 and 64 bit exe or is it good enough to simply supply a 32 bit exe.
« Last Edit: February 09, 2021, 07:22:03 am by Badger »
Badger
(A bad tempered, grumpy animal that sleeps most of the winter!)

If at first you don't succeed - you're running about average!

I'm using Windows 10 Lazarus v2.4.4  FPC 3.2.2   Win 32/64

440bx

  • Hero Member
  • *****
  • Posts: 4014
Re: 64 bit/32 bit problem
« Reply #1 on: January 09, 2021, 08:21:47 am »
1 - Can I compile using Target platform options Win32/i386/ etc or do I have to install and use the 32 bit lazarus.
2 - So that other people can use the program, should I provide a 32 and 64 bit exe or is it good enough to simply supply a 32 bit exe.
1.  You don't need the 32bit version of Lazarus, you can keep using the 64bit version. Simply setting the option to Win32 is enough.  You don't even need to set the CPU to i386, leave it as x86_64.

2. For the time being 32bit programs will run under all desktop version of Windows, that will change only if and when MS decides to drop 32bit support in their 64bit Windows, that's not likely to happen soon.   A 32bit program will run slower when executed by a 64bit version of Windows but, in many cases the difference is small (though that is highly dependent on what the program does.)  IOW, a 32bit program will run on any version of Windows but a 64bit program will run faster than the same 32bit program executed on a 64bit Windows.


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

bb84000

  • Newbie
  • Posts: 3
Re: 64 bit/32 bit problem
« Reply #2 on: January 09, 2021, 09:59:39 am »
Hello,

Can I compile using Target platform options Win32/i386/ etc or do I have to install and use the 32 bit lazarus.

If you have installed Lazarus 64bit (lazarus-2.0.10-fpc-3.2.0-win64.exe), install lazarus i386 32bit cross compiler(lazarus-2.0.10-fpc-3.2.0-cross-i386-win32-win64.exe).
You can compile a 32bit-i386 application for computers using Windows 32 bit on a 32 bit CPU, along with a 64 bit-x86_64 application. The choose of 32 bit and 64 bit install can be done by the installer.

bb

PascalDragon

  • Hero Member
  • *****
  • Posts: 5462
  • Compiler Developer
Re: 64 bit/32 bit problem
« Reply #3 on: January 09, 2021, 11:33:32 am »
1 - Can I compile using Target platform options Win32/i386/ etc or do I have to install and use the 32 bit lazarus.
2 - So that other people can use the program, should I provide a 32 and 64 bit exe or is it good enough to simply supply a 32 bit exe.
1.  You don't need the 32bit version of Lazarus, you can keep using the 64bit version. Simply setting the option to Win32 is enough.  You don't even need to set the CPU to i386, leave it as x86_64.

Not quite. The cross compiler from x86_64-win64 to i386-win32 needs to be installed as bb84000 explained.

440bx

  • Hero Member
  • *****
  • Posts: 4014
Re: 64 bit/32 bit problem
« Reply #4 on: January 09, 2021, 11:54:10 am »
Not quite. The cross compiler from x86_64-win64 to i386-win32 needs to be installed as bb84000 explained.
You're right. I forgot that the cross compiler needs to be installed too. 
« Last Edit: January 09, 2021, 12:23:42 pm by 440bx »
(FPC v3.0.4 and Lazarus 1.8.2) or (FPC v3.2.2 and Lazarus v3.2) on Windows 7 SP1 64bit.

Badger

  • Full Member
  • ***
  • Posts: 144
Re: 64 bit/32 bit problem
« Reply #5 on: January 17, 2021, 03:31:18 am »
It all seemed so easy! :(

Having a few problems with the above advice.

1.  If I try to set Program Options/Config and Target to Win 32 and i386 as suggested by bb84000, I get a message that FPC 3.0.4 for 64 bit is not supported.  I can live with that.

2. If I try to set target to Win 32 and default Target CPU Family I get an error message 'The current FPC has no config file. It will probably miss some units.  Check your installation of FPC. 
On clicking OK, I get error message 'The project uses target OS=win32 and CPU x84_64.The system.ppu for this target was not found in the FPC binary directories  Make sure the fpc is installed correctly for this target and the fpc.cfg contains the right directories.

Can I get some 'easy to understand' advice please
Badger
(A bad tempered, grumpy animal that sleeps most of the winter!)

If at first you don't succeed - you're running about average!

I'm using Windows 10 Lazarus v2.4.4  FPC 3.2.2   Win 32/64

Badger

  • Full Member
  • ***
  • Posts: 144
Re: 64 bit/32 bit problem
« Reply #6 on: February 03, 2021, 02:36:18 am »
Sorry for the delay in getting back.  The world doesn't stand still for part time programmers!

Thanks for the advice jamie.  The problem is I will need to compile the program for platforms other than windows based so, not having access to a Mac, I will need to cross-compile.  So I am back to the problem I raised a while ago

Quote
2. If I try to set target to Win 32 and default Target CPU Family I get an error message 'The current FPC has no config file. It will probably miss some units.  Check your installation of FPC.
On clicking OK, I get error message 'The project uses target OS=win32 and CPU x84_64.The system.ppu for this target was not found in the FPC binary directories  Make sure the fpc is installed correctly for this target and the fpc.cfg contains the right directories.

Any advice?
Badger
(A bad tempered, grumpy animal that sleeps most of the winter!)

If at first you don't succeed - you're running about average!

I'm using Windows 10 Lazarus v2.4.4  FPC 3.2.2   Win 32/64

AL

  • Sr. Member
  • ****
  • Posts: 264
Re: 64 bit/32 bit problem
« Reply #7 on: February 03, 2021, 03:13:39 am »
Hello,

Can I compile using Target platform options Win32/i386/ etc or do I have to install and use the 32 bit lazarus.

If you have installed Lazarus 64bit (lazarus-2.0.10-fpc-3.2.0-win64.exe), install lazarus i386 32bit cross compiler(lazarus-2.0.10-fpc-3.2.0-cross-i386-win32-win64.exe).
You can compile a 32bit-i386 application for computers using Windows 32 bit on a 32 bit CPU, along with a 64 bit-x86_64 application. The choose of 32 bit and 64 bit install can be done by the installer.

bb

Have you installed the cross compiler as quoted?
« Last Edit: February 03, 2021, 03:15:25 am by AL »
Laz 3.1, fpc 3.2.2, Win10
Laz 3.1  fpc 3.2.2, MacOS Monterey running on VMWare/Win 10
Laz 3.1  fpc 3.2.2 Ubuntu 20.04

dseligo

  • Hero Member
  • *****
  • Posts: 1219
Re: 64 bit/32 bit problem
« Reply #8 on: February 03, 2021, 08:14:26 am »
Why not use fpcdeluxe https://wiki.freepascal.org/fpcupdeluxe for that?

Zoran

  • Hero Member
  • *****
  • Posts: 1830
    • http://wiki.lazarus.freepascal.org/User:Zoran
Re: 64 bit/32 bit problem
« Reply #9 on: February 03, 2021, 10:45:44 am »
not having access to a Mac, I will need to cross-compile.

Cross-compiling for targets on which you cannot test the programme's behaviour will solve nothing.

Badger

  • Full Member
  • ***
  • Posts: 144
Re: 64 bit/32 bit problem
« Reply #10 on: February 06, 2021, 04:13:51 am »
Quote
Have you installed the cross compiler as quoted?

Went back and upgraded to latest Lazarus and FPC and it is now Working.

Quote
Cross-compiling for targets on which you cannot test the programme's behaviour will solve nothing.
Isn't the ability to cross compile to other platforms one of the advantages of Lazarus? (Anyone in Tasmania got an old Mac I can borrow for a few months?) ::)
Badger
(A bad tempered, grumpy animal that sleeps most of the winter!)

If at first you don't succeed - you're running about average!

I'm using Windows 10 Lazarus v2.4.4  FPC 3.2.2   Win 32/64

PascalDragon

  • Hero Member
  • *****
  • Posts: 5462
  • Compiler Developer
Re: 64 bit/32 bit problem
« Reply #11 on: February 06, 2021, 04:24:37 pm »
Quote
Cross-compiling for targets on which you cannot test the programme's behaviour will solve nothing.
Isn't the ability to cross compile to other platforms one of the advantages of Lazarus? (Anyone in Tasmania got an old Mac I can borrow for a few months?) ::)

But cross-compiling is only part of the solution. You also need to test whether your application behaves as expected or as a user of that platform might expect. Or if there are problems that aren't covered by simple compilation checks (e.g. path differences).

Badger

  • Full Member
  • ***
  • Posts: 144
Re: 64 bit/32 bit problem
« Reply #12 on: February 09, 2021, 07:20:45 am »
Sorry PascalDragon, I was being tongue-in-cheek.  I will use a Mac cross compile for a couple of very simple programs and hope for the best.  I'll  just have to see what Father Christmas  manages for my larger work.

Thanks all for your help.
Badger
(A bad tempered, grumpy animal that sleeps most of the winter!)

If at first you don't succeed - you're running about average!

I'm using Windows 10 Lazarus v2.4.4  FPC 3.2.2   Win 32/64

 

TinyPortal © 2005-2018