Recent

Author Topic: Is Cocoa the future for Lazarus on macOS?  (Read 20386 times)

wittbo

  • Full Member
  • ***
  • Posts: 150
Is Cocoa the future for Lazarus on macOS?
« on: July 16, 2017, 10:25:39 am »
Hi,
since some months I'm working on a cross-platform project; cross-platform means, I would like to get it run on win64 and macOS 64bit. My development platform is macos 10.10 with Lazarus 1.6.4. I started with the carbon widgetset (IDE always carbon), made some experiences with colors, fontsizes and not really working border settings. But ok, the application works fine and can be compiled under WinXP and Win10 without errors. There are some minor adjustments necessary concerning fonts and font sizes and relative adjustments of GUI components, but the result is good enough. The functionality including SQLite database is without any problem.

But what will happen in the future? Within the next one or two years all 32bit applications won't no longer work on actual macOSses. So it seems to me the only way of survival on macOS is migrating to Cocoa 64bit widgetset. So I made my first experiences with Cocoa. IDE stayed on carbon, compiler switch was set to cocoa. Some minor bugs could be handled by workarounds, but then came some severe problems (app crashes on opening a windows OnShow Event, another window only showed less than the half of all visual components, ...). I doubt, that cocoa will ever be a stable platform on macOS. That would mean (for me), that Lazarus will die for macOS within the next two years.

My first Pascal course was in 1981 (may be, I'm an IT grandfather), then stepped into UCDS Pascal with Apple II, followed by  Delphi about 20 years ago. I'm loving this language very much and would do much to help further development for this platform. I'm not a real IT compiler technician and I cannot look very deeply into the secrets of the underlying libraries, but I decided to register for the freepascal bug tracker and to help a little bit to make lazarus-cocoa as a stable pascal software development platform.
-wittbo-
MBAir with MacOS 10.14.6 / Lazarus 2.2.4
MacStudio with MacOS 13.0.1 / Lazarus 2.2.4

mischi

  • Full Member
  • ***
  • Posts: 170
Re: Is Cocoa the future for Lazarus on macOS?
« Reply #1 on: July 16, 2017, 12:49:53 pm »
I disagree with lazarus will die for macOS. I only agree, that it will become more difficult.

First, with the removal of 32-bit carbon, the pressure for cocoa development increases and I expect faster progress.

Second, already now, you can try the 64-bit Qt4-based lcl, which looks pretty good. If this fails, too, the last option is the gtk2-based lcl, which admittedly looks horrible. Both approaches require the installation of additional libraries for the development, but with some effort it is possible to even create standalone applications.

In order to simplify these, I have created package descriptions for fink, a Debian-like package manager, for the Qt4- and gtk2-based lcls. They drag in all what is needed automatically. The currently supported versions are lazarus-1.6.4 and fpc-3.0.2. As soon as newer releases (1.8.0 and 3.0.4) are out, I will update.

However, Xcode and Swift are a tempting alternative.

No reason to despair - MiSchi

Leledumbo

  • Hero Member
  • *****
  • Posts: 8744
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: Is Cocoa the future for Lazarus on macOS?
« Reply #2 on: July 16, 2017, 02:57:58 pm »
As time pressure increases, let's hope more contributors are coming to finish the Cocoa widgetset. The better way is to of course find capable contributors and work on it right away.

Phil

  • Hero Member
  • *****
  • Posts: 2737
Re: Is Cocoa the future for Lazarus on macOS?
« Reply #3 on: July 16, 2017, 03:37:29 pm »
Hi,
since some months I'm working on a cross-platform project; cross-platform means, I would like to get it run on win64 and macOS 64bit. My development platform is macos 10.10 with Lazarus 1.6.4.

The Cocoa widgetset code in 1.6.4 is ancient. You need to try 1.8.0 RC3 or, even better, the trunk code:

https://macpgmr.github.io/MacXPlatform/UsingCocoaFromTrunk.html

There are still some gaps and bugs in the Cocoa widgetset, but if you use 1.6.4 you're almost assured that your program won't work with Cocoa.

Phil

  • Hero Member
  • *****
  • Posts: 2737
Re: Is Cocoa the future for Lazarus on macOS?
« Reply #4 on: July 16, 2017, 03:47:21 pm »
Second, already now, you can try the 64-bit Qt4-based lcl

But is that even true anymore? The Qt 4.8.6 package for Mac is now incompatible with El Capitan and later, probably because it tries to put files in /usr/bin. And I was unable to compile the interface framework for 64-bits.

Laz 1.8 includes support for Qt5, as well as the C++ code for compiling the interface framework yourself, but has any Mac user ever gotten that to work? I posed that question here a while back and got no response, so I would guess we know the answer.

No, I don't think that Qt, with or without fink, is a viable answer to new Mac developers who want to try out Lazarus and expect 64-bit Cocoa out of the box.


However, Xcode and Swift are a tempting alternative.

No reason to despair - MiSchi

Apple reported last month that 3 million new developers had signed up in the previous year. Perhaps a few of them were Lazarus users, but probably not more than a handful.

https://www.macstories.net/news/apples-wwdc-keynote-by-the-numbers/

What's your definition of despair?

Phil

  • Hero Member
  • *****
  • Posts: 2737
Re: Is Cocoa the future for Lazarus on macOS?
« Reply #5 on: July 16, 2017, 04:04:10 pm »
As time pressure increases, let's hope more contributors are coming to finish the Cocoa widgetset. The better way is to of course find capable contributors and work on it right away.

Felipe is pretty good about fixing bugs in the Cocoa widgetset, but these bugs do need to be reported. I'll admit that creating a test project that demos a bug and logging a bug report is probably one of the most tedious things that a developer can do, but it has to be done if you want a complete Cocoa widgetset some day.

I would say that 1.6.4 is about the end of the line for the Carbon widgetset. No one is working on it anymore and 1.8 introduced some serous regressions. Carbon will probably do for a while as the IDE, but we need to start targeting Cocoa for the apps, reporting bugs as they're uncovered.


DonAlfredo

  • Hero Member
  • *****
  • Posts: 1738
Re: Is Cocoa the future for Lazarus on macOS?
« Reply #6 on: July 16, 2017, 04:27:28 pm »
QT 5.6 works fine with Lazarus trunk on 10.12 ! And I would like to thank the developer who has done all the QT5-work.
IMHO, QT is the way to go on 64bit.

Phil

  • Hero Member
  • *****
  • Posts: 2737
Re: Is Cocoa the future for Lazarus on macOS?
« Reply #7 on: July 16, 2017, 04:36:56 pm »
QT 5.6 works fine with Lazarus trunk on 10.12 ! And I would like to thank the developer who has done all the QT5-work.
IMHO, QT is the way to go on 64bit.

That's good to hear, but again I don't think that's a viable choice for new developers. It does require a 1.1 GB download just to get the Qt5 frameworks. Plus there's the issue of deployment of those frameworks with your app. Gulp.

I regularly use two apps on Mac that use Qt: QGIS and Microsoft's Remote Desktop. The look and feel is pretty good, but I note that they still use Qt 4.8 and the issue of Qt library size adding to deployment is moot (QGIS.app footprint is over 600MB, so what's another 40MB for the Qt libraries?).

Unfortunately, the Qt5 widgetset interface library dropped support for QWebEngine (what 4.x called QWebView), so I can't add support to TWebBrowser, which now has proof-of-concept suppot for Qt4 on Lazarus:

https://macpgmr.github.io/MacXPlatform/lclwebbrowser-src.zip

No, Cocoa has to be where Lazarus gets to on Mac. Otherwise, there's no point to it.


mischi

  • Full Member
  • ***
  • Posts: 170
Re: Is Cocoa the future for Lazarus on macOS?
« Reply #8 on: July 16, 2017, 05:11:55 pm »
But is that even true anymore? The Qt 4.8.6 package for Mac is now incompatible with El Capitan and later, probably because it tries to put files in /usr/bin. And I was unable to compile the interface framework for 64-bits.

No, I don't think that Qt, with or without fink, is a viable answer to new Mac developers who want to try out Lazarus and expect 64-bit Cocoa out of the box.

The fink packages for qt4, version 4.8.7 work flawlessly on 10.12. Fink packages never ever install stuff in /usr/bin. This has probably been fixed by the maintainer of the fink packages since ages. Secondly, i am not aware of any related problems with my lazarus-qt4 fink package on 10.12. At least, i have not received any bug report so far. Correct me, if i am wrong on this.

MiSchi.

mischi

  • Full Member
  • ***
  • Posts: 170
Re: Is Cocoa the future for Lazarus on macOS?
« Reply #9 on: July 16, 2017, 05:16:51 pm »
QT 5.6 works fine with Lazarus trunk on 10.12 ! And I would like to thank the developer who has done all the QT5-work.
IMHO, QT is the way to go on 64bit.
For me that means, that it is time to pick it up and create a fink package description for it. Lazarus 1.8.0 sounds like a good starting point.

Phil

  • Hero Member
  • *****
  • Posts: 2737
Re: Is Cocoa the future for Lazarus on macOS?
« Reply #10 on: July 16, 2017, 05:17:35 pm »
The fink packages for qt4, version 4.8.7 work flawlessly on 10.12. Fink packages never ever install stuff in /usr/bin. This has probably been fixed by the maintainer of the fink packages since ages.

Right, the Qt boys should have known better. For example, FPC has never installed to /usr/bin, I don't believe, only to /usr/local.

In any case, it's now well documented what locations are reserved for macOS:

https://developer.apple.com/library/content/documentation/Security/Conceptual/System_Integrity_Protection_Guide/FileSystemProtections/FileSystemProtections.html#//apple_ref/doc/uid/TP40016462-CH2-DontLinkElementID_2

I don't see a 4.8.7 Qt package:

http://download.qt.io/archive/qt/4.8/

Do you know of a different download site?

Phil

  • Hero Member
  • *****
  • Posts: 2737
Re: Is Cocoa the future for Lazarus on macOS?
« Reply #11 on: July 16, 2017, 05:18:49 pm »
QT 5.6 works fine with Lazarus trunk on 10.12 ! And I would like to thank the developer who has done all the QT5-work.
IMHO, QT is the way to go on 64bit.
For me that means, that it is time to pick it up and create a fink package description for it. Lazarus 1.8.0 sounds like a good starting point.

Do you include the Qt frameworks too?

mischi

  • Full Member
  • ***
  • Posts: 170
Re: Is Cocoa the future for Lazarus on macOS?
« Reply #12 on: July 16, 2017, 05:26:22 pm »
Do you know of a different download site?
I was talking about the fink packages.

http://pdb.finkproject.org/pdb/package.php/qt4-base-mac

http://pdb.finkproject.org/pdb/browse.php?name=lazarus&nochildren=on

Sure enough, you need to install fink, which is quite a step for a casual user, but should not be so much of a problem for a developer.

Fink package descriptions are supposed to take care of all installation issues and usually do so. In many cases, maintainers report issues to upstream, but the issues are not always picked up by upstream developers. Compared to MacPorts and Homebrew there are some Cons and Pros.

MiSchi.
« Last Edit: July 16, 2017, 05:37:52 pm by mischi »

mischi

  • Full Member
  • ***
  • Posts: 170
Re: Is Cocoa the future for Lazarus on macOS?
« Reply #13 on: July 16, 2017, 05:28:56 pm »
Do you include the Qt frameworks too?
Since there are already package descriptions for Qt5, declaring appropriate dependencies in the package description of lazarus-qt5 takes care of it.

MiSchi.

Phil

  • Hero Member
  • *****
  • Posts: 2737
Re: Is Cocoa the future for Lazarus on macOS?
« Reply #14 on: July 16, 2017, 05:42:15 pm »
Sure enough, you need to install fink, which is quite a step for a casual user, but should not be so much of a problem for a developer.

I can see the use case for Qt5 and fink with Lazarus on Mac, but that would be a very small number of developers, perhaps vanishingly small, possibly only experienced developers with large apps who are comfortable with Qt and deploying and supporting Qt (ie, C++ developers). But that is not a solution for the rest of us.

The problem for Lazarus on Mac is not that it can't attract Mac users, but that it can't retain them. And can you blame these users? 32-bit Carbon? gdb? Are you kidding me? That should be the normal reaction to Lazarus. And a quick exit stage right. And that's exactly what happens. Just follow the postings and subsequent silence from new Mac users here.

Lazarus on Mac just needs to be something reasonable. Easy to get installed and started with and capable of creating apps that aren't an embarrassment. Carbon needs to be deprecated like GTK1 was. We should be emphasizing the targeting of Cocoa, warts and all.


 

TinyPortal © 2005-2018