Recent

Author Topic: Making a cross platform program  (Read 995 times)

justnewbie

  • Sr. Member
  • ****
  • Posts: 292
Making a cross platform program
« on: October 08, 2022, 01:42:50 pm »
Hi Friends,
Is there any "how to" about making cross platform programs?
Specifically, I made the Linux version of my program, but I need to make its Windows 64-bit version as well.
It is totally new for me, so a detailed, step-by-step instruction would be nice. Thanks.

MarkMLl

  • Hero Member
  • *****
  • Posts: 6692
Re: Making a cross platform program
« Reply #1 on: October 08, 2022, 02:01:05 pm »
The most relevant question is whether you want to do it using cross-compilation or on a different machine.

Assuming that you're running Lazarus, in the second case I'd suggest using a File -> Clean Directory followed by a Project -> Publish Project, unless you've used any OS-specific stuff things should just work.

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

justnewbie

  • Sr. Member
  • ****
  • Posts: 292
Re: Making a cross platform program
« Reply #2 on: October 08, 2022, 02:32:05 pm »
I would be a cross-compilation.

Zoran

  • Hero Member
  • *****
  • Posts: 1831
    • http://wiki.lazarus.freepascal.org/User:Zoran
Re: Making a cross platform program
« Reply #3 on: October 08, 2022, 02:34:54 pm »
I would be a cross-compilation.

The simplest thing to do is -- install Lazarus on Windows and compile your project there.

It is much simpler than cross-compiling and, with cross-compiling, you will certainly have to test the application on Windows.

So, even with cross-compiling, you still need a working Windows system.

In short -- you need a Windows, at least for testing, so better avoid cross-compiling.

If you still want to cross-compile, I have no experience with it, but probably the easiest way is with fpcup-deluxe, see here.

MarkMLl

  • Hero Member
  • *****
  • Posts: 6692
Re: Making a cross platform program
« Reply #4 on: October 08, 2022, 02:58:56 pm »
The simplest thing to do is -- install Lazarus on Windows and compile your project there.

Or possibly use one of these newfangled "Linux in Windows" hacks.

"Embrace, extend, extinguish"...

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

Fred vS

  • Hero Member
  • *****
  • Posts: 3168
    • StrumPract is the musicians best friend
Re: Making a cross platform program
« Reply #5 on: October 08, 2022, 03:33:31 pm »
Hello.

You may also use the "wine" Windows emulator for linux.

Code: Bash  [Select][+][-]
  1. sudo apt-get install wine

and then install fpc-lazarus for Windows via wine.

So first develop your application with fpc-lazarus for Linux and then use the same source but compile it using wine+fpc7lazarus for windows.

You way test also your Windows application with wine on Linux.

I do it for all my cross platform projects but, like Zoran noted, for the release it is better to test it on a real Windows machine to check if all is ok.
I use Lazarus 2.2.0 32/64 and FPC 3.2.2 32/64 on Debian 11 64 bit, Windows 10, Windows 7 32/64, Windows XP 32,  FreeBSD 64.
Widgetset: fpGUI, MSEgui, Win32, GTK2, Qt.

https://github.com/fredvs
https://gitlab.com/fredvs
https://codeberg.org/fredvs

justnewbie

  • Sr. Member
  • ****
  • Posts: 292
Re: Making a cross platform program
« Reply #6 on: October 08, 2022, 03:38:07 pm »
I would be a cross-compilation.

The simplest thing to do is -- install Lazarus on Windows and compile your project there.

It is much simpler than cross-compiling and, with cross-compiling, you will certainly have to test the application on Windows.

So, even with cross-compiling, you still need a working Windows system.

In short -- you need a Windows, at least for testing, so better avoid cross-compiling.

If you still want to cross-compile, I have no experience with it, but probably the easiest way is with fpcup-deluxe, see here.
To be honest, I've already tried to do it (using VirtualBox >> Linux host and Windows7 guest). I got an "access violation" error at compiling.
« Last Edit: October 08, 2022, 03:51:15 pm by justnewbie »

justnewbie

  • Sr. Member
  • ****
  • Posts: 292
Re: Making a cross platform program
« Reply #7 on: October 08, 2022, 03:48:11 pm »
Hello.

You may also use the "wine" Windows emulator for linux.

Code: Bash  [Select][+][-]
  1. sudo apt-get install wine

and then install fpc-lazarus for Windows via wine.

So first develop your application with fpc-lazarus for Linux and then use the same source but compile it using wine+fpc7lazarus for windows.

You way test also your Windows application with wine on Linux.

I do it for all my cross platform projects but, like Zoran noted, for the release it is better to test it on a real Windows machine to check if all is ok.
As I can remember, I tried this a long time ago with another project, but without success. Maybe I will give it a go again. Thank you for the tip.

winni

  • Hero Member
  • *****
  • Posts: 3197
Re: Making a cross platform program
« Reply #8 on: October 08, 2022, 04:24:54 pm »

avra

  • Hero Member
  • *****
  • Posts: 2514
    • Additional info
Re: Making a cross platform program
« Reply #9 on: October 08, 2022, 04:52:25 pm »
Read this if you decide to go cross compilation path:
https://wiki.lazarus.freepascal.org/Cross_compiling#From_Linux_to_Windows
ct2laz - Conversion between Lazarus and CodeTyphon
bithelpers - Bit manipulation for standard types
pasettimino - Siemens S7 PLC lib

justnewbie

  • Sr. Member
  • ****
  • Posts: 292
Re: Making a cross platform program
« Reply #10 on: October 08, 2022, 05:20:15 pm »
Thank you, guys! I will study them.

 

TinyPortal © 2005-2018