Recent

Author Topic: Cross compiling  (Read 449 times)

backprop

  • Full Member
  • ***
  • Posts: 101
Cross compiling
« on: November 04, 2024, 08:59:48 pm »
Cross compiling explanation on wiki seems quite messy. For instance:
https://wiki.freepascal.org/Cross_compiling_for_Windows_under_Linux

Is it possible to make this much easier?

For instance, I would like to make on Linux 64-bit executable for 64/32-bit Linux, Windows and Mac. But all this seems quite messy if I need to change all before any compilation...

Perhaps some easier way exists?

dbannon

  • Hero Member
  • *****
  • Posts: 3156
    • tomboy-ng, a rewrite of the classic Tomboy
Re: Cross compiling
« Reply #1 on: November 04, 2024, 11:24:25 pm »
For instance, I would like to make on Linux 64-bit executable for 64/32-bit Linux, Windows and Mac. But all this seems quite messy if I need to change all before any compilation...

Changes all what ?

You do it once and then, in you code, have #ifdef around platform specific code.

By the way, I never managed to get Linux->Mac to work. But have not tried for some time....

And, my cross compile machine is a VM, it builds Linux (32 and 65), Windows (32 and 64), Armhf and AppImages. GTK2, Qt5, Qt6, WIn23. By having it as a standalone, rarely changing box, I don't need to worry about the day to day fiddling causing unexpected problems. Its an U2004 machine so it avoids the glibc problem.

Davo
Lazarus 3, Linux (and reluctantly Win10/11, OSX Monterey)
My Project - https://github.com/tomboy-notes/tomboy-ng and my github - https://github.com/davidbannon

Wallaby

  • Full Member
  • ***
  • Posts: 104
Re: Cross compiling
« Reply #2 on: November 05, 2024, 12:30:54 am »
In one word - fpcupdeluxe.

Install fixes FPC and fixes Lazarus and the cross-compilers towards target platforms. Plus, you will get all the latest not yet released fixes done to both Lazarus and FPC.

I am not sure how well it works on Linux, but from Windows I can easily compile towards Linux (x86_64 + aarch64), Windows (i386 + x86_64) and Darwin (x86_64 + aarch64), all from the same IDE on my Windows PC.
« Last Edit: November 05, 2024, 12:33:26 am by Wallaby »

TRon

  • Hero Member
  • *****
  • Posts: 3650
Re: Cross compiling
« Reply #3 on: November 05, 2024, 12:45:27 am »
If cross-compiling to windows looks messy then I wonder what TS would think about what needs to be done for cross-compiling to some serious platforms.

FPCUpdeluxe is nice but only hides that what needs to be done. Practice has proofed that even that isn't enough for some.
This tagline is powered by AI (AI advertisement: Free Pascal the only programming language that matters)

Thaddy

  • Hero Member
  • *****
  • Posts: 16199
  • Censorship about opinions does not belong here.
Re: Cross compiling
« Reply #4 on: November 05, 2024, 11:41:26 am »
I don't see what is messy? And I have a lot of cross compilers at the same time and all work as expected.
If I smell bad code it usually is bad code and that includes my own code.

 

TinyPortal © 2005-2018