Recent

Author Topic: Cross-platform - how to target Linux  (Read 5843 times)

carl_caulkett

  • Hero Member
  • *****
  • Posts: 654
Re: Cross-platform - how to target Linux
« Reply #15 on: October 16, 2024, 04:39:22 pm »
Basically, the position of the project as explained to me was that FPC/Lazarus allowed a collection of source files to be compiled on a fairly wide selection of systems, but did not promise that a binary built on one system would work on another.

It was actually put somewhat less gently than that, and I am still unhappy about it.

The problem is that Linux is not very supportive of moving binaries between systems.

I'm very quickly arriving at the same conclusion ;)

I'm thinking now, the next step is to install FPC 3.31/Lazarus 3.99 on Linux and build my app there...
"It builds... ship it!"

MarkMLl

  • Hero Member
  • *****
  • Posts: 8533
Re: Cross-platform - how to target Linux
« Reply #16 on: October 16, 2024, 04:50:46 pm »
I'm very quickly arriving at the same conclusion ;)

FPC's problems between 3.0 and 3.2 vs Debian 11 and 12 were particularly gross.

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Logitech, TopSpeed & FTL Modula-2 on bare metal (Z80, '286 protected mode).
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

TRon

  • Hero Member
  • *****
  • Posts: 4377
Re: Cross-platform - how to target Linux
« Reply #17 on: October 16, 2024, 04:54:03 pm »
So fpcupdeluxe would have me believe ;)
Indeed it does.

What is strange is that FPCUpdeluxe seem to have opted for 3.2.2 for the cross-compiler ? (are you able to confirm ?)

And in case Don is reading this and the answer is yes then the obvious next question becomes why ?
Today is tomorrow's yesterday.

LV

  • Sr. Member
  • ****
  • Posts: 419
Re: Cross-platform - how to target Linux
« Reply #18 on: October 16, 2024, 04:55:23 pm »
Basically, the position of the project as explained to me was that FPC/Lazarus allowed a collection of source files to be compiled on a fairly wide selection of systems, but did not promise that a binary built on one system would work on another.

It was actually put somewhat less gently than that, and I am still unhappy about it.

The problem is that Linux is not very supportive of moving binaries between systems.


I'm very quickly arriving at the same conclusion ;)

I'm thinking now, the next step is to install FPC 3.31/Lazarus 3.99 on Linux and build my app there...


I've been using the Lazarus IDE for a bit over a year.
I went down this path right away. To my delight, the motto "Write Once Compile Anywhere" worked without problems :)

carl_caulkett

  • Hero Member
  • *****
  • Posts: 654
Re: Cross-platform - how to target Linux
« Reply #19 on: October 16, 2024, 04:55:55 pm »
I'm running Ubuntu 24.10 (dunno if that's Debian 12 under the hood...).
On Ubuntu you can
Code: [Select]
$ cat /etc/debian_version
bookworm/sid
The recent versions of Debian versions/codenames are:
Quote
12 bookworm
13 trixie
14 forky

I'm on trixie/sid apparently...
"It builds... ship it!"

DonAlfredo

  • Hero Member
  • *****
  • Posts: 1862
Re: Cross-platform - how to target Linux
« Reply #20 on: October 16, 2024, 05:00:30 pm »
Fpcupdeluxe does not opt. It just uses the sources from the install itself. And crossing towards Linux Aarch64 is very straight forward.
So I am in the dark.
Trunk should not be necessary.
It might be the glibc problem.

carl_caulkett

  • Hero Member
  • *****
  • Posts: 654
Re: Cross-platform - how to target Linux
« Reply #21 on: October 16, 2024, 05:22:40 pm »
AFAIK, there are no tools to cross towards aarch64 on Mac M1.
Did you realy succeed in building a cross-compiler ?

While you're here, may I ask, what's the easiest way of installing fpcupdeluxe on a Linux Ubuntu 24.10 (Debian 13) VM running in a VMWare VM on an Mac Mini M1 (Silicon)?

If all else fails, I guess I can try to install FPC 3.2.2/Lazarus 3.6 and then build FpcUpDeluxe from source...
"It builds... ship it!"

MarkMLl

  • Hero Member
  • *****
  • Posts: 8533
Re: Cross-platform - how to target Linux
« Reply #22 on: October 16, 2024, 05:29:16 pm »
Fpcupdeluxe does not opt. It just uses the sources from the install itself. And crossing towards Linux Aarch64 is very straight forward.
So I am in the dark.
Trunk should not be necessary.
It might be the glibc problem.

The thing that convinced me that I was out of my depth- at least considering available resources- was recovering the FPC 3.0 and 3.2 linker scripts (-sh option?) and looking at the ELF files being generated (readelf -a) which were grossly different.

I think it was TRon who discovered that a 3.0-built file could be run on Deb 12 if the user had root privilege: I strongly suspect (from readelf output) that Debian 12 thinks that a program built using FPC 3.0 is about to write to an unexpected segment (in ELF terms, i.e. this might not be limited to x86). Taking that into account, I'm surprised that there haven't been reports of FPC being malware...

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Logitech, TopSpeed & FTL Modula-2 on bare metal (Z80, '286 protected mode).
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

DonAlfredo

  • Hero Member
  • *****
  • Posts: 1862
Re: Cross-platform - how to target Linux
« Reply #23 on: October 16, 2024, 05:29:45 pm »
If you have a vanilla install of Debian, you needs some extras. Use this script to install the extras.
https://github.com/LongDirtyAnimAlf/fpcupdeluxe/blob/master/installscripts/debian.sh
The get the correct fpcupdeluxe.
https://github.com/LongDirtyAnimAlf/fpcupdeluxe/releases/download/v2.4.0e/fpcupdeluxe-aarch64-linux
Run it and you should be good to go.

Anyhow.
The cross-compiling from M1 should work.
Would be good to try to solve the issue !

carl_caulkett

  • Hero Member
  • *****
  • Posts: 654
Re: Cross-platform - how to target Linux
« Reply #24 on: October 16, 2024, 05:43:27 pm »
Thanks Don! I've downloaded https://github.com/LongDirtyAnimAlf/fpcupdeluxe/releases/download/v2.4.0e/fpcupdeluxe-aarch64-linux in my Ubuntu, but where is the best folder to copy it to, and from where to run it? I want to instill some good Linux working practices from the start 😉
"It builds... ship it!"

carl_caulkett

  • Hero Member
  • *****
  • Posts: 654
Re: Cross-platform - how to target Linux
« Reply #25 on: October 16, 2024, 06:05:53 pm »
I've stuck it in /opt/fpcdeluxe, and created a desktop shortcut to it!

I then tried to run it...

The bad news is that an access violation came up straight away - image 1,
but the good news is that I pressed OK and saw image 2 in all its glory :D
"It builds... ship it!"

carl_caulkett

  • Hero Member
  • *****
  • Posts: 654
Re: Cross-platform - how to target Linux
« Reply #26 on: October 16, 2024, 06:15:36 pm »
The only problem, that keen-eyed observers will have spotted straight away but I missed in my initial euphoria, is that there are no versions listed in either the FPC or the Lazarus columns... :o

And, when I click the `Trunk` button, I get another access violation message, i'm guessing because of the same problem as the initial message...
« Last Edit: October 16, 2024, 06:23:40 pm by carl_caulkett »
"It builds... ship it!"

DonAlfredo

  • Hero Member
  • *****
  • Posts: 1862
Re: Cross-platform - how to target Linux
« Reply #27 on: October 16, 2024, 06:49:10 pm »
You are running in a privileged folder.
Don't.
Just place fpcupdeluxe into some folder in your home-directory and run as the normal user. Do not run as superuser.

carl_caulkett

  • Hero Member
  • *****
  • Posts: 654
Re: Cross-platform - how to target Linux
« Reply #28 on: October 16, 2024, 07:37:19 pm »
You are running in a privileged folder.
Don't.
Just place fpcupdeluxe into some folder in your home-directory and run as the normal user. Do not run as superuser.

Excellent! Thanks very much. It's all displaying as it should (I hope!) 😉
"It builds... ship it!"

carl_caulkett

  • Hero Member
  • *****
  • Posts: 654
Re: Cross-platform - how to target Linux
« Reply #29 on: October 16, 2024, 09:08:56 pm »
You are running in a privileged folder.
Don't.
Just place fpcupdeluxe into some folder in your home-directory and run as the normal user. Do not run as superuser.

Thanks again, Don! Thanks to you excellent tool and your timely intervention just now, I've now got a working copy of FPC 3.3.1/Lazarus 3.99 running on my Linux VM.
I must say that the default app looks much better in Linux than it does on Windows 😉

There's just the small matter of the actual MIDI code to sort out, but that can wait another day...
« Last Edit: October 16, 2024, 09:10:51 pm by carl_caulkett »
"It builds... ship it!"

 

TinyPortal © 2005-2018