Recent

Author Topic: [SOLVED] Compiling a GUI app on macOS  (Read 5453 times)

bienvenu

  • Newbie
  • Posts: 6
[SOLVED] Compiling a GUI app on macOS
« on: March 24, 2017, 07:19:05 pm »
Dear Lazarus power users,

I'm part of a small team that has recently ported a rather large Delphi application to Lazarus. Everything went fine and I must say we were very happy with Lazarus!

The application is free software and it aimed mostly at students and researchers. It works fine on Windows and Linux (using both Qt and GTK). The source can be found here: https://gitlab.com/ecoevomath/ulm/

Now, we would like to compile the application and its GUI on recent versions of macOS (say, OS X 1.0* or, even better, macOS Sierra). It really does not matter which GUI toolkit we end up using, we would just like to get a functional app, and so far we have been unable to do this.

What we have tried includes:
  • compiling in 32-bits and using Carbon: the compilation goes fine but the interface is completely broken and unusable.
  • compiling in 64-bits and using Cocoa: same problem.
  • compiling with Qt5: according the the documentation of Lazarus, the Qt5 binding is ready but will only be available in Lazarus 1.8. So we have tried to compile using CodeTyphon (http://www.pilotlogic.com/sitejoom/index.php/codetyphon --from what we understand, it packages a more recent version of Lazarus than the current official version). However, we have not yet managed to install the Qt5 binding...

We haven't tried very hard to compile with GTK or Qt4 because as Qt4 is no supported by recent versions of Mac and GTK require to emulate X11, that would make the program much harder to install for end-users... Our preferred option would probably be to use Qt5 because we could it on Linux, but as I said anything that works (while keeping the program reasonably easy to install) would do.

Some things I forgot to say:
  • Our application uses the SynEdit widget.
  • We are not experienced Mac users, so it could be that we missed something quite obvious...

Any help would be greatly appreciated because we are out of ideas and so unless one of you can help we're going to drop Mac support...

I can provide more detailed information about what we tried and what failed.

Thanks in advance!

bienvenu for the ULM development team.
« Last Edit: April 03, 2017, 10:54:26 pm by bienvenu »

Phil

  • Hero Member
  • *****
  • Posts: 2737
Re: Compiling a GUI app on macOS
« Reply #1 on: March 24, 2017, 07:34:26 pm »
  • compiling in 32-bits and using Carbon: the compilation goes fine but the interface is completely broken and unusable.

In general, it should be possible to recreate the Windows look of Lazarus apps using the Carbon widgetset. Whether that's good enough for Mac users (I would suggest it is not) is between you and your users.

Without seeing screenshots or example code, I would guess that you programmed the user interface without regard to the differences from Windows that Mac software represents. Maybe you could describe or illustrate one or two showstopper issues in the UI on Mac using the Carbon widgetset.

The Carbon widgetset, while not perfect, is fairly complete and stable and probably won't get much more love, since Cocoa is what apps should be using since about forever.

See the link at the bottom of this article for tips on improving your app on Mac. I have no idea if these things have anything to do with your UI issues, but they represent things that apply to most Mac apps.

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

AlexTP

  • Hero Member
  • *****
  • Posts: 2386
    • UVviewsoft
Re: Compiling a GUI app on macOS
« Reply #2 on: March 25, 2017, 03:32:23 pm »
On Mac app is broken. pls give n screenshots. Maybe panels aligned wrong, maybe anchors dont work, etc.
2) Give small (very small) app which is ok on Win32 and broken on Mac - it may be 1-2-3 panels, synedit.
3) Pls use only Carbon (Cocoa not done)

mischi

  • Full Member
  • ***
  • Posts: 170
Re: Compiling a GUI app on macOS
« Reply #3 on: March 25, 2017, 03:48:04 pm »
Hi.

If you want to try Qt4 on a recent macOS, you may try my fink packages of lazarus 1.6.4.
Also, I want to point out that for distribution on macOS you need to take care of code signing and build a disk image. It is not that much of rocket science and can be done with a Makefile or another script.

I had a quick try with the git sources and i386-carbon. I created the macOS application bundle and selected the bundle for starting. Looked ok so far. Could you please be more specific about your problems?

MiSchi.
« Last Edit: March 25, 2017, 08:42:22 pm by mischi »

bienvenu

  • Newbie
  • Posts: 6
Re: Compiling a GUI app on macOS
« Reply #4 on: March 26, 2017, 01:05:53 am »
Thank you very much for your replies and your help!

Phi and Alextp, when I said the GUI was broken and usuable, what I meant that the app was unresponsive: some panels could not be moved, and some buttons could not be clicked. Apart from the layout, of the widgets on the forms was the same as under Windows or Linux.

I will try to post a screenshot and detail the problem soon. I do not know if posting a minimum working example would help here, because we do not have one specific problem... We have an app that does not use any system specific function and as expected, we were able to get it to work under both Windows and Linux without changing the code. But when we try to compile "naively" on Mac (e.g., using lazbuild from the command line, or compiling from the Lazarus IDE), the app seems broken. So my guess was that we're not "compiling it right"...

MiSchi, thanks so much for compiling and for your message on the GitLab issue tracker. I will reply to the post you left there, and when the issue is solved I will post a summary of the GitLab discussion on this forum for future reference.


Phil

  • Hero Member
  • *****
  • Posts: 2737
Re: Compiling a GUI app on macOS
« Reply #5 on: March 26, 2017, 01:14:57 am »
Phi and Alextp, when I said the GUI was broken and usuable, what I meant that the app was unresponsive: some panels could not be moved, and some buttons could not be clicked.

You did create the app bundle, right? That's a folder with an .app extension that contains Info.plist file, your executable, etc.


AlexTP

  • Hero Member
  • *****
  • Posts: 2386
    • UVviewsoft
Re: Compiling a GUI app on macOS
« Reply #6 on: March 26, 2017, 10:25:11 pm »
Buttons not clicked(all buttons- not some of buttons) if you didnt make App bundle, same note.

mischi

  • Full Member
  • ***
  • Posts: 170
Re: Compiling a GUI app on macOS
« Reply #7 on: April 02, 2017, 11:02:23 pm »
Just to keep you up to date: Most issues could be resolved and a macOS application is available. For details check gitlab. One thing of general interest is that setting the property top of a form to 0 is bad for carbon. 23 does the trick. I make an entry on the macOS wiki page.

MiSchi.

bienvenu

  • Newbie
  • Posts: 6
Re: [SOLVED] Compiling a GUI app on macOS
« Reply #8 on: April 03, 2017, 11:01:08 pm »
Dear all,

As MiSchi said, the problem was solved. As you had guess we had not created the app bundle.

I'm adding some keywords to this post to make it easier to Google:

Lazarus macOS unresponsive buttons unmovable window -> do not forget to create application application bundle

Thanks again for your help and sorry for dumb question  :-[

Best,

bienvenu

 

TinyPortal © 2005-2018