[Lazarus] How to switch a project from 32 to 64 bit (on Windows 7 x64)?

classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

[Lazarus] How to switch a project from 32 to 64 bit (on Windows 7 x64)?

Free Pascal - Lazarus mailing list
I started out on a project using Lazarus/Fpc 32 bit (2.0.0/3.0.4) and
now I want to switch to the 64 bit version of Lazarus/Fpc.
I have installed both 32 and 64 bit versions using the downloadable
installers so they are separate programs in their separate folder
trees.

I thought that I could start Lazarus 64 bit and then open the 32 bit
project and save it as a 64 bit project afterwards, but that failed
completely...
Turns out I have to also install some dependencies that the project
uses. Most important is the PasLibVlc library...

Since Lazarus can compile across platforms, can it also be directed to
compile on the *same* platform (Windows) but using different bit
versions (32 bit and 64 bit)?

Since I have both installed on my laptop it would be nice to be able
to manage both 32 and 64 bit versions from the same environment, if
possible.

But how should I go about telling my Lazarus 32 bit about the 64 bit
compiler already installed (it is the same version)?

And how do I differentiate between the different target executables
when building? Can Lazarus be told to build both at the same time?


--
Bo Berglund
Developer in Sweden

--
_______________________________________________
lazarus mailing list
[hidden email]
https://lists.lazarus-ide.org/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] How to switch a project from 32 to 64 bit (on Windows 7 x64)?

Free Pascal - Lazarus mailing list
On Mon, 27 May 2019 17:49:31 +0200, Bo Berglund via lazarus
<[hidden email]> wrote:

>Since I have both installed on my laptop it would be nice to be able
>to manage both 32 and 64 bit versions from the same environment, if
>possible.

I found the following method:

Build modes can be used to handle this.

I have enabled build modes Win32 and Win64 and set these to different
executable output names. I also modified the target OS and CPU family
correspondingly.

Still it is a manual operation to select the correct build mode
depending on which IDE I have opened.
Is there some way to automatically select build mode depending on the
version of the IDE (32 or 64 bit on Windows)?

In the 64 bit IDE I can now build both 32 and 64 bit executables just
by switching the build mode.

But if I use Lazarus 32 bit then it it works fine to build the 32 bit
version but complains when I try to build the 64 bit version:

"Compiler:
C:\Programs\lazarus_2.0\fpc\3.0.4\bin\i386-...\fpc.exe
does not support target x86_64-win64"

It seems like the 64 bit fpc compiler can handle both targets but the
32 bit one not....

Is this solvable?

OTH, if the 64 bit Lazarus can handle both 32 and 64 bit Windows, why
bother with the 32 bit Lazarus?


--
Bo Berglund
Developer in Sweden

--
_______________________________________________
lazarus mailing list
[hidden email]
https://lists.lazarus-ide.org/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] How to switch a project from 32 to 64 bit (on Windows 7 x64)?

Free Pascal - Lazarus mailing list
This is easy to do that, you only need one Lazarus, the 64bit version and the cross-i386 fpc compiler, you can remove Lazarus 32.
The only point to be careful is the default target for a new project will be Win64 and you have to add a Win32 build mode to all your projects. But the default target is saved with the project so this is a one time setup.
And to not overlap 32 and 64 build files you must be sure the Output directory path contain $(TargetCPU).

The files to install are lazarus-2.0.2-fpc-3.0.4-win64 first, then lazarus-2.0.2-fpc-3.0.4-cross-i386-win32-win64, both available from https://sourceforge.net/projects/lazarus/files/Lazarus%20Windows%2064%20bits/Lazarus%202.0.2/

Patrick
--
_______________________________________________
lazarus mailing list
[hidden email]
https://lists.lazarus-ide.org/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] How to switch a project from 32 to 64 bit (on Windows 7 x64)?

Free Pascal - Lazarus mailing list
On Tue, 28 May 2019 07:13:36 +0000, Patrick Chevalley via lazarus
<[hidden email]> wrote:

>This is easy to do that, you only need one Lazarus, the 64bit version and the cross-i386 fpc compiler, you can remove Lazarus 32.
>The only point to be careful is the default target for a new project will be Win64 and you have to add a Win32 build mode to all your projects. But the default target is saved with the project so this is a one time setup.
>And to not overlap 32 and 64 build files you must be sure the Output directory path contain $(TargetCPU).
>
>The files to install are lazarus-2.0.2-fpc-3.0.4-win64 first, then lazarus-2.0.2-fpc-3.0.4-cross-i386-win32-win64, both available from https://sourceforge.net/projects/lazarus/files/Lazarus%20Windows%2064%20bits/Lazarus%202.0.2/
>
>Patrick

Thanks for the description!

Right now I have the following installed in my Win7 x64 environment:
Lazarus 1.6
Lazarus 1.8
Lazarus 1.8.4 32 bit
Lazarus 2.0.0 32 bit
Lazarus 2.0.0 64 bit

All of these have internbal fpc directories containing the
correspondiing fpc compiler files.

Do you recommend uninstalling ALL of these and instead get and install
Lazarus 2.0.2 as described above?

What happens with the project history of the removed versions?
Is there some file I can save to keep that available?


--
Bo Berglund
Developer in Sweden

--
_______________________________________________
lazarus mailing list
[hidden email]
https://lists.lazarus-ide.org/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] How to switch a project from 32 to 64 bit (on Windows 7 x64)?

Free Pascal - Lazarus mailing list
I don't know your workflow and why you keep the old version of Lazarus? for maintenance of older version of your applications?

In this case do not remove them but install the 2.0.2 Lazarus and cross-compiler in a new Lazarus 2.0.2 directory then create a new config for 2.0.2 as usual.

Patrick
--
_______________________________________________
lazarus mailing list
[hidden email]
https://lists.lazarus-ide.org/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] How to switch a project from 32 to 64 bit (on Windows 7 x64)?

Free Pascal - Lazarus mailing list
On Tue, 28 May 2019 09:13:32 +0000, Patrick Chevalley via lazarus
<[hidden email]> wrote:

>I don't know your workflow and why you keep the old version of Lazarus?
>for maintenance of older version of your applications?

Not really, I tend to instal the latest version now and then and so I
build up a library of older versions, which I don't use anymore...
So I will remove them shortly, but first install 2.0.2 as you
suggested.

>
>In this case do not remove them but install the 2.0.2 Lazarus and cross-compiler
>in a new Lazarus 2.0.2 directory then create a new config for 2.0.2 as usual.
>

Is there a cross-compiler which allows building the programs for Linux
too (Linux running on the same CPU)?
Maybe also for Linux on ARM (Raspberry Pi)?

Currently I install Lazarus/FPC on the linux machines and then I use
Subversion to get the sources over to Linux and build there. It would
be more convenient to be able to build the tools in my main
environment and use on Linux by moving the binary over.


--
Bo Berglund
Developer in Sweden

--
_______________________________________________
lazarus mailing list
[hidden email]
https://lists.lazarus-ide.org/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] How to switch a project from 32 to 64 bit (on Windows 7 x64)?

Free Pascal - Lazarus mailing list
In reply to this post by Free Pascal - Lazarus mailing list
Am 28.05.2019 um 10:40 schrieb Bo Berglund via lazarus:
> Right now I have the following installed in my Win7 x64 environment:
> Lazarus 1.6
> Lazarus 1.8
> Lazarus 1.8.4 32 bit
> Lazarus 2.0.0 32 bit
> Lazarus 2.0.0 64 bit
>
> All of these have internbal fpc directories containing the
> correspondiing fpc compiler files.

The same with me (plus some more, in particular trunk installations for
Lazarus and fpc). This is indispensable for testing when your code
should not be tied to the newest IDE version.

Normally, it is no problem to switch between different versions. But be
aware: When loading an project in a new version may change the project
in a way that it is not readable by the old version again. Laz 2.0, for
example, can add the line "Application.Scaled" to the project unit when
you use the High-dpi features - this is a problem for 1.6. (You may
enclose the line by an $IFDEF which helps for some time, but after some
changes the IDE is very persistent and adds the line again). Or Lazarus
trunk introduces a new file structure, you must save every new project
with checed "Maximize compatibility of project files" in "Project
options" > "Miscellaneous"; otherwise the project will have no files in
Laz 2.0.2 or older.

--
_______________________________________________
lazarus mailing list
[hidden email]
https://lists.lazarus-ide.org/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] How to switch a project from 32 to 64 bit (on Windows 7 x64)?

Free Pascal - Lazarus mailing list
In reply to this post by Free Pascal - Lazarus mailing list
It is probably possible to cross compile from Windows to Linux (Gtk2) but this is difficult to setup because you need to copy a lot a Linux library to your Windows system.
I don't know if Fpcupdeluxe can help with that?

The other way is much more easy because the win32 LCL do not expect the Windows DLL to be there for linking. So compiling for Win32 or Win64 from Linux is just a matter of changing the target in the build mode.  

Patrick
--
_______________________________________________
lazarus mailing list
[hidden email]
https://lists.lazarus-ide.org/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] How to switch a project from 32 to 64 bit (on Windows 7 x64)?

Free Pascal - Lazarus mailing list
On Tue, 28 May 2019 11:03:36 +0000, Patrick Chevalley via lazarus
<[hidden email]> wrote:

>It is probably possible to cross compile from Windows to Linux (Gtk2) but this is difficult to setup because you need to copy a lot a Linux library to your Windows system.
>I don't know if Fpcupdeluxe can help with that?
>
>The other way is much more easy because the win32 LCL do not expect the Windows DLL to be there for linking. So compiling for Win32 or Win64 from Linux is just a matter of changing the target in the build mode.  

OK, I see...
Meanwhile I have installed 2.0.2 as you suggested with the
cross-compiler and used OPM to get Indy installed and then manually
installed the PasLibVlc package.
Next I opened the old project and built the two targets WIn 32 and 64
and it all went well!

So I will start uninstalling the old versions now (freeing up 6+ GB of
disk), and I also found Lazarus 1.4 in my disk...


--
Bo Berglund
Developer in Sweden

--
_______________________________________________
lazarus mailing list
[hidden email]
https://lists.lazarus-ide.org/listinfo/lazarus