Recent

Author Topic: Lazarus and FPC for different OS  (Read 4869 times)

geraldholdsworth

  • Full Member
  • ***
  • Posts: 195
Lazarus and FPC for different OS
« on: December 09, 2020, 07:41:26 pm »
How easy would it be to compile Lazarus and FPC for another operating system, which is currently not supported?

The OS in question is RISC OS (5.28 is the latest stable version, 5.29 is in beta) on an ARM processor (since ARM 1 back in the mid eighties). It is a 32 bit OS, but there are murmurings about re-writing it for ARM64 - but that will be a long way off.

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 11383
  • FPC developer.
Re: Lazarus and FPC for different OS
« Reply #1 on: December 09, 2020, 07:49:04 pm »
The short answer is "it depends".

Amongst others

- finding an assembler/linker
- adjusting the compiler for non-standard ABI features.
- writing an RTL

geraldholdsworth

  • Full Member
  • ***
  • Posts: 195
Re: Lazarus and FPC for different OS
« Reply #2 on: December 09, 2020, 07:52:56 pm »
- finding an assembler/linker
Not a problem - it's built in.
- writing an RTL
Ah...yes, that's where I fail. I've only ever dabbled in ARM assembler (at least 30-odd years ago), and a little bit of C++ (about 20-odd years ago).

PascalDragon

  • Hero Member
  • *****
  • Posts: 5446
  • Compiler Developer
Re: Lazarus and FPC for different OS
« Reply #3 on: December 10, 2020, 10:05:52 am »
- writing an RTL
Ah...yes, that's where I fail. I've only ever dabbled in ARM assembler (at least 30-odd years ago), and a little bit of C++ (about 20-odd years ago).

Porting FPC to a new OS (especially if the CPU is already supported as is the case for RISC OS) can be an interesting endeavour. In fact it was one of the first changes I submitted to FPC around 12 years back or so by adding support for the NativeNT target (I should really update that for x86_64 and now aarch64... :-\ ).

A bit more (slightly outdated) information about adding a new target can be found here.

I had taken a quick look at RISC OS (at least the website) in the past and was a bit confused whether it and its development SDK is free or not, though it seems that RISC OS Open clears up that issue. Maybe I'll simply give it a try in the future... ;)

Edit: Ah, it was the Desktop Development Environment that had confused me. %)
« Last Edit: December 10, 2020, 10:07:54 am by PascalDragon »

lproven

  • New member
  • *
  • Posts: 9
Re: Lazarus and FPC for different OS
« Reply #4 on: December 10, 2020, 04:02:40 pm »
In case I can help... Hello, long-time RISC OS user, member of the RO User Group of London. I know some of the people in the RO community and could do introductions, if it'd help. I am trying to learn my way around FreePascal and Lazarus at present because I want to try some things with Ultibo.

Yes, the OS is now open source, since the formation of a new company, RISC OS Developments Ltd. who acquired the license along with the defunct Castle Technologies Ltd. who continued making Acorn computers, and Acorn compatibles, after Acorn closed its workstations division.

(Just to muddy the waters, there are 2 forks of RO. The other fork is _not_ FOSS and is owned by a different company, 3QD: http://www.riscos.com/legal/terms.htm That company's main business is selling a commercial Acorn computer emulator so that old-time Acorn users can continue to use the OS and apps on top of Windows or macOS. The company now owns its own version of the OS, which a predecessor company bought direct from Acorn. The FOSS fork derives from a separate Acorn licence sold to Pace Technologies, the modem/STB/satellite-receiver company.)

The FOSS fork is called RISC OS Open and is maintained & developed by RISC OS Open Ltd., known as ROOL.

Snag: AIUI, the dev tools to rebuild the OS are _not_ FOSS, and whereas ROOL offer them at a big discount from the previous owners, you still must buy it. Some of RO is written in ARM assembler, but parts are in C and I think they use a compiler formerly called Norcroft C but now just known as the DDE: https://www.riscosopen.org/content/sales/dde

However, that's for rebuilding the OS itself. You don't need it for building apps for the OS. Although it's the official tool, there are multiple alternatives, including GCC: https://www.riscos.info/index.php/GCC_for_RISC_OS

Using the RO GCCSDK it's also possible to cross-compile for RISC OS on top of GCC's native xNix environments, e.g. ARM Linux or x86 Linux.

RISC OS Open is a native single-core single-threaded 32-bit ARM OS, derived from Pace's work on ARM NCs -- network computers. There is currently no 64-bit version and discussions have only started fairly recently on how they might do one, prompted by ARM releasing 64-bit _only_ ARM chips which can no longer execute 32-bit ARM code.

RISC OS uses cooperative multitasking, and can only pre-empt a text-mode command-line (compare to Windows 2 or 3).

(The original Acorn RISC OS was 26-bit.)

RISC OS' API is like nothing else in the world. It is the only 1980s desktop OS that survives into the modern world. NeXTstep (the basis for Mac OS X) is a couple of years younger.

A decade or so back, there _were_ shim libraries to allow porting of Unix apps (UnixLib), and separately, of X.11 apps (ChoX11), but the RO community were suspicious of these apps and their non-native look and feel. In the end, the developer quit working on RISC OS and emigrated.

So I think any UI integration work would need to be done entirely from scratch. RISC OS has a rich WIMP desktop with all the usual controls, but a radically different look and feel from anything else out there -- because it predates anything else out there. It even predates Windows 2.

So, for instance:
• no menu bars -- the only menus are context menus;
• running an app installs an icon in the "icon bar" at the bottom of the screen. This must be middle-clicked to open a context menu to quit, access the About dialog, etc. By convention, left-clicking it opens the app's first document window;
• no Apply button in dialogs; right-clicking OK applies settings but leaves the dialog open;
• no directory browser or navigation in file-open or file-save dialogs -- Save presents a file icon which the user drags to the destination directory;
• window title bar changes colour and title is suffixed with * to indicate changed contents which should be saved before closing/exiting.

... And many more. Acorn devised and built its own GUI from first principles, starting only a couple of years after the Apple Macintosh was released. Its icon bar informed the Windows 95 taskbar, but little else.

Experience has shown that RISC OS users will refuse apps that don't conform to the rest of the desktop. So, for instance, RISC OS has never, up until now, had a web browser capable of Javascript. (2 are currently in development.) The user base simply refused the port of Firefox from Linux, principally because it did not conform to the RISC OS UI. They'd rather put up with no modern (21st century) web browser than use an alien web-browser with a non-standard look and feel.

I note that, in my experiments on macOS, the Lazarus IDE for FP has a very non-standard UI for a Mac app. Basically, it feels like a Windows app running natively under macOS. I can only say that I strongly suspect that no matter how powerful the tool, the RISC OS user community would refuse such a tool.

Not that I want to be off-putting, as I think this would be a _tremendous_ asset to RISC OS, _especially_ as RISC OS is natively supported on Raspberry Pi, is the fastest OS on the platform, and FPC is also natively supported on bare-metal on RasPi via Ultibo. The possible synergies are tremendous.

PascalDragon

  • Hero Member
  • *****
  • Posts: 5446
  • Compiler Developer
Re: Lazarus and FPC for different OS
« Reply #5 on: December 10, 2020, 04:31:03 pm »
Yes, the OS is now open source, since the formation of a new company, RISC OS Developments Ltd. who acquired the license along with the defunct Castle Technologies Ltd. who continued making Acorn computers, and Acorn compatibles, after Acorn closed its workstations division.

(Just to muddy the waters, there are 2 forks of RO. The other fork is _not_ FOSS and is owned by a different company, 3QD: http://www.riscos.com/legal/terms.htm That company's main business is selling a commercial Acorn computer emulator so that old-time Acorn users can continue to use the OS and apps on top of Windows or macOS. The company now owns its own version of the OS, which a predecessor company bought direct from Acorn. The FOSS fork derives from a separate Acorn licence sold to Pace Technologies, the modem/STB/satellite-receiver company.)

The FOSS fork is called RISC OS Open and is maintained & developed by RISC OS Open Ltd., known as ROOL.

Snag: AIUI, the dev tools to rebuild the OS are _not_ FOSS, and whereas ROOL offer them at a big discount from the previous owners, you still must buy it. Some of RO is written in ARM assembler, but parts are in C and I think they use a compiler formerly called Norcroft C but now just known as the DDE: https://www.riscosopen.org/content/sales/dde

However, that's for rebuilding the OS itself. You don't need it for building apps for the OS. Although it's the official tool, there are multiple alternatives, including GCC: https://www.riscos.info/index.php/GCC_for_RISC_OS

That definitely clears things up, thanks.

A decade or so back, there _were_ shim libraries to allow porting of Unix apps (UnixLib), and separately, of X.11 apps (ChoX11), but the RO community were suspicious of these apps and their non-native look and feel. In the end, the developer quit working on RISC OS and emigrated.

From what I see the initial target would be the Shared C Library. As FPC has a good track record of working with non-POSIX systems it shouldn't be impossible. ;) (especially considering that GCC supports it as well ::) )

Experience has shown that RISC OS users will refuse apps that don't conform to the rest of the desktop. So, for instance, RISC OS has never, up until now, had a web browser capable of Javascript. (2 are currently in development.) The user base simply refused the port of Firefox from Linux, principally because it did not conform to the RISC OS UI. They'd rather put up with no modern (21st century) web browser than use an alien web-browser with a non-standard look and feel.

Please note that right now I'm talking about FPC only. That means either command line applications or GUI applications written directly with the RISC OS API.

I note that, in my experiments on macOS, the Lazarus IDE for FP has a very non-standard UI for a Mac app. Basically, it feels like a Windows app running natively under macOS. I can only say that I strongly suspect that no matter how powerful the tool, the RISC OS user community would refuse such a tool.

The Lazarus IDE is designed to be cross platform with good maintainability for the developers. An UI completely adjusted to a platform would simply not be feasible.

geraldholdsworth

  • Full Member
  • ***
  • Posts: 195
Re: Lazarus and FPC for different OS
« Reply #6 on: December 10, 2020, 06:10:11 pm »
Yes, the OS is now open source, since the formation of a new company, RISC OS Developments Ltd. who acquired the license along with the defunct Castle Technologies Ltd. who continued making Acorn computers, and Acorn compatibles, after Acorn closed its workstations division.
Hi Liam - thank you for that. You put it better than I ever could.
A decade or so back, there _were_ shim libraries to allow porting of Unix apps (UnixLib), and separately, of X.11 apps (ChoX11), but the RO community were suspicious of these apps and their non-native look and feel. In the end, the developer quit working on RISC OS and emigrated.
The RO community lost out. We need tools like those, and Lazarus. The software developed by volunteers is some of the best around. Companies just develop software that will make them money, volunteers develop software that people actually want, IMHO.
The Lazarus IDE is designed to be cross platform with good maintainability for the developers. An UI completely adjusted to a platform would simply not be feasible.
Can't different aspects of the projects be different for the different platforms, adjusted by using the compiler directives ({$IFDEF Darwin} or {$IFDEF Win64}, for example)?
So the bulk of the code would be the same, but the platform specific stuff only gets compiled depending on which platform Lazarus/FPC is running on.

MarkMLl

  • Hero Member
  • *****
  • Posts: 6676
Re: Lazarus and FPC for different OS
« Reply #7 on: December 10, 2020, 07:53:57 pm »
The FOSS fork derives from a separate Acorn licence sold to Pace Technologies, the modem/STB/satellite-receiver company.)

Ahhh. I remember talking to a couple of Pace guys in about '89. They assured me that they were second to none as far as set-top boxes were concerned but were trying to promote the RT-OS they'd just bought from somewhere. Of course, even in those days they were up against people like Wind River, which made it a tricky sell.

Quote
Snag: AIUI, the dev tools to rebuild the OS are _not_ FOSS, and whereas ROOL offer them at a big discount from the previous owners, you still must buy it. Some of RO is written in ARM assembler, but parts are in C and I think they use a compiler formerly called Norcroft C but now just known as the DDE: https://www.riscosopen.org/content/sales/dde

Now granted that we're only considering this part for completeness, but assuming that the codebase has been fairly stable since the late 80s it's fair to assume that their C is either K&R or a very early ANSI possibly with some Lint facilities stirred in. At that point I find myself wondering how difficult it would be to extend something like SDCC with any extra facilities that are required.

Apropos development tools, some comments at https://retrocomputing.stackexchange.com/questions/16153/when-did-compilers-start-generating-optimized-code-that-runs-faster-than-an-aver might interest... I got the impression that one or two people there might have had inside knowledge.

Quote
Experience has shown that RISC OS users will refuse apps that don't conform to the rest of the desktop. So, for instance, RISC OS has never, up until now, had a web browser capable of Javascript. (2 are currently in development.) The user base simply refused the port of Firefox from Linux, principally because it did not conform to the RISC OS UI. They'd rather put up with no modern (21st century) web browser than use an alien web-browser with a non-standard look and feel.

I suppose that I shouldn't be surprised. There's some things that I... really can't discuss right now, but somebody who did contract work had Pace modem sourcecode which suggests that he was at one point one of their developers, and he... wasn't exactly easy to deal with. I got the impression that even in the early 2000s he would have preferred to be doing his work on a BBC Micro, and some of his terminology definitely was tainted by that sort of architecture.

Quote
Not that I want to be off-putting, as I think this would be a _tremendous_ asset to RISC OS, _especially_ as RISC OS is natively supported on Raspberry Pi, is the fastest OS on the platform, and FPC is also natively supported on bare-metal on RasPi via Ultibo. The possible synergies are tremendous.

The average Cambridge developer is so superior that once he's been shown it can be done I'm sure that he'd be able to knock up a new IDE in a few days.

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

PascalDragon

  • Hero Member
  • *****
  • Posts: 5446
  • Compiler Developer
Re: Lazarus and FPC for different OS
« Reply #8 on: December 11, 2020, 09:21:18 am »
The Lazarus IDE is designed to be cross platform with good maintainability for the developers. An UI completely adjusted to a platform would simply not be feasible.
Can't different aspects of the projects be different for the different platforms, adjusted by using the compiler directives ({$IFDEF Darwin} or {$IFDEF Win64}, for example)?
So the bulk of the code would be the same, but the platform specific stuff only gets compiled depending on which platform Lazarus/FPC is running on.

We're talking about the UI and it's behaviour here. That is a completely different beast than just some code changes. Also one needs to test these. How should I who doesn't have an up to date macOS (I only have a 10.4 PowerBook) test whether my UI changes work correctly on a macOS as well? No. That's effort we can't do.

geraldholdsworth

  • Full Member
  • ***
  • Posts: 195
Re: Lazarus and FPC for different OS
« Reply #9 on: December 11, 2020, 12:48:51 pm »
We're talking about the UI and it's behaviour here. That is a completely different beast than just some code changes. Also one needs to test these. How should I who doesn't have an up to date macOS (I only have a 10.4 PowerBook) test whether my UI changes work correctly on a macOS as well? No. That's effort we can't do.
Yep, you're right - sometimes (well, a lot of times) my head writes cheques it can't cash.

"Can your application do such-and-such?"
"No, but I can put it in for you" (without thinking how to implement said request)

lproven

  • New member
  • *
  • Posts: 9
Re: Lazarus and FPC for different OS
« Reply #10 on: December 11, 2020, 09:40:58 pm »
That definitely clears things up, thanks.

Oh good! Glad that I could help.

The situation is quite complicated, and unfortunately, most of the people in the tiny scene are not really used to doing outreach. Like many small niche computer communities, they're very keen, but often not familiar with other stuff from outside their world.

Quote
From what I see the initial target would be the Shared C Library. As FPC has a good track record of working with non-POSIX systems it shouldn't be impossible. ;) (especially considering that GCC supports it as well ::) )

Ah, that sounds much more promising.

Quote
Please note that right now I'm talking about FPC only. That means either command line applications or GUI applications written directly with the RISC OS API.

OK, now I understand a little better. I am quite new to this world; I only dabbled in Pascal at Uni and in my first job, and I totally failed to get to grips with Delphi. I am lamentably out of touch.

Quote
The Lazarus IDE is designed to be cross platform with good maintainability for the developers. An UI completely adjusted to a platform would simply not be feasible.

Ahh, I see. That is a bit of a pity from the RO POV. Modern macOS and Windows have both borrowed quite a lot from one another, and some flagship macOS apps (Firefox, Chrome, MS Office, LibreOffice, and many more) are not fully native – they are cross-platform products and they tend to favour the Windows way of working.

Which means Mac users are used to Windows-like stuff and tolerate it. Many won't even notice.

(Things were different in the old days on classic MacOS. For instance, while everyone loved MS Word 5.1a – a true native Mac app and widely-loved – MS Word 6 was a port based on the Windows source tree and was almost universally hated.)

Since all the Linux desktops are largely a copy of the Win95 one (except for some rounding errors*), Linux people don't care so much about these things.

----
* GNUstep, ROX Desktop, and others even more obscure.

lproven

  • New member
  • *
  • Posts: 9
Re: Lazarus and FPC for different OS
« Reply #11 on: December 11, 2020, 09:55:37 pm »
Hi Liam - thank you for that. You put it better than I ever could.

Oh my! Well, you're welcome. Happy to help.

Quote
The RO community lost out. We need tools like those, and Lazarus. The software developed by volunteers is some of the best around. Companies just develop software that will make them money, volunteers develop software that people actually want, IMHO.

I entirely agree. I said so in some fora at the time, but it was largely ignored.

I think part of the problem is that some old-time RO users regard other OSes merely as things that can be used to launch a RO emulation environment. Because their preferred OS is older, and far smaller and faster, it is obvious that it is therefore also better and so they see little to no need to take anything from any other OS.

I have some sympathy. For instance, although I'm typing on a lovely 27" retina iMac, I started out on classic MacOS and I still miss a lot from it. In most objective ways it was far inferior to Mac OS X – poor multitasking, weak networking, very poor stability, no SMP support, etc. etc. – but for cleanness of UI, for simplicity and elegance, it was unparalleled.

I am or have been familiar with 25-30 different OSes in my life, maybe more. Now I work with just 3, and I am not a huge fan of any of them.

Classic MacOS had about the best GUI ever written, IMHO. RISC OS exceeded it in some ways -- the simplicity and elegance of its file manager, and the consistency of the OS and apps, possibly even exceeded the Mac. For instance, while I'm perfectly comfortable with the Mac's global menu bar, it is not a great solution in a multitasking environment: it changes, apparently randomly, and accidentally clicking the wrong app and getting the wrong menu is a common occurrence.

Firefox and Chrome no longer have menu bars by default – but they do on Mac OS X. MS Office replaced its menus with Ribbons, which I personally loathe, but on the Mac the menus are still there.

Lazarus has one, but options are in the wrong places. About Lazarus should be on the Lazarus menu, not under Help. "Options" should be "Preferences" and on there too. Small things like that annoy regular users of just one OS.

Windows' menu bars, inside windows, work better with multitasking, but they're much harder to hit with the mouse because they violate Fitt's Law. They're on their way out now, too, replaced by more ribbons.

RISC OS' solution was more general, more elegant, simpler and quicker. It's even easier to hit a menu where you don't have to move the mouse at all, than to hit the edge of the screen! It scales well to small low-res screens and to big high-res screens too -- unlike Apple's solution.

(The other one I admired, incidentally, was BeOS, an elegant synthesis of the best of the Mac and the best of Windows, IMHO.)

Quote
Can't different aspects of the projects be different for the different platforms, adjusted by using the compiler directives ({$IFDEF Darwin} or {$IFDEF Win64}, for example)?
So the bulk of the code would be the same, but the platform specific stuff only gets compiled depending on which platform Lazarus/FPC is running on.

That would seem desirable, but it might be a lot of work.

OTOH, for instance, if a framework for moving and rearranging menu entries could be devised, so that some entries could be moved to other menus on macOS, then that could pave the way for a more RO-like port for RO...

lproven

  • New member
  • *
  • Posts: 9
Re: Lazarus and FPC for different OS
« Reply #12 on: December 11, 2020, 10:01:08 pm »
We're talking about the UI and it's behaviour here. That is a completely different beast than just some code changes. Also one needs to test these. How should I who doesn't have an up to date macOS (I only have a 10.4 PowerBook) test whether my UI changes work correctly on a macOS as well? No. That's effort we can't do.

Just FWIW... when I was back in London (and able to meet MarkMLl here face-to-face) I was so broke that a modern Intel Mac was out of the question. I managed to successfully Hackintosh a Core 2 Extreme box I got from the local FreeCycle group. I used the graphics card and drives from my old PC.

It worked very well, served as my main computer for 2-3 years, and is still in the basement here in Prague, awaiting some TLC.

I would be happy to offer some assistance and pointers. Current macOS is a free download.

This won't apply for long, as Apple is migrating away from Intel, but I think it's very doable with something like macOS 10.13, which still works absolutely fine.
 
The main priorities are an all-Intel machine, a supported graphics card, and a dedicated hard disk, so OS X doesn't have to share drives with anything else.

PascalDragon

  • Hero Member
  • *****
  • Posts: 5446
  • Compiler Developer
Re: Lazarus and FPC for different OS
« Reply #13 on: December 13, 2020, 04:48:18 pm »
I would be happy to offer some assistance and pointers. Current macOS is a free download.

No, thank you. I don't want a modern macOS.

 

TinyPortal © 2005-2018