Recent

Author Topic: App doesn't show when run (MAC OS)  (Read 4363 times)

tduccuong

  • New member
  • *
  • Posts: 7
App doesn't show when run (MAC OS)
« on: January 23, 2019, 10:50:14 pm »
hi,

I use Lazarus 1.8.4 to create a GUI app which runs well in Windows and Ubuntu. Now, the same codebase also compiles in MAC Mojave but when I run it (from within IDE), nothing shows up.

I searched the Internet (and this forum), there are things about form position out of screen, multiple screens, form not visible at start, app bundle needs to be created, etc. I tried them all, but nothing works.

I tried double-click the app bundle too, but it seems it runs and quits at same time (just like it does if I run within IDE), nothing shows up too.

The weird thing is, if I double-click on the executable from within Finder, a console is opened and the app does show up, but it is not responsive at all. It looks like it is disabled, like a static image which does not react to any mouse click or key press.

Please show me some directions?

Thanks a lot!

jamie

  • Hero Member
  • *****
  • Posts: 7651
Re: App doesn't show when run (MAC OS)
« Reply #1 on: January 23, 2019, 10:52:28 pm »
Did you change the widget to gkt or qt  ?

Also you need to have these items installed If I understand it..
The only true wisdom is knowing you know nothing

Trenatos

  • Hero Member
  • *****
  • Posts: 537
    • MarcusFernstrom.com
Re: App doesn't show when run (MAC OS)
« Reply #2 on: January 24, 2019, 02:09:21 am »
Hm, I've seen this behavior sometimes when a GUI app has been deployed as a CLI app.

Mac GUI apps should be packaged up in a .app

The executable is called 'project' and that's also specified in the Info.plist in the .app bundle.

When you run Lazarus on a Mac you have the option of automatically create an app bundle.

I can't post an example on the forum (Stupid setting, only allows 250kb uploads) so I put one here  https://github.com/MFernstrom/jsl/releases just grab the .zip file.

tduccuong

  • New member
  • *
  • Posts: 7
Re: App doesn't show when run (MAC OS)
« Reply #3 on: January 24, 2019, 10:18:55 am »
thanks guys for quick answers :)

@jamie:
no, everything is default i.e., "carbon" in my case.

@Trenatos:
your project.app does run and show up correctly. But the source code is empty or? I see only a license and a readme.md file in the zip...

Also, I did check the option to automatically create .app bundle in Lazarus IDE. The Info.plist file is generated by the IDE.

I noticed, that if i create a new test app in MAC, with same project options (i.e., default by Lazarus) like the one with problems, the test app runs fine! So maybe something with importing project (.lpi file) from Windows?

Trenatos

  • Hero Member
  • *****
  • Posts: 537
    • MarcusFernstrom.com
Re: App doesn't show when run (MAC OS)
« Reply #4 on: January 24, 2019, 04:13:20 pm »
Yeah I just dropped a working zip file in an empty repo I had, I didn't put any source code as it's just standard settings for "New Project" -> "Application" and then I added a single label.

It very well could be that it has to do with importing from a Windows project, I'd guess it's also importing settings, so you'd have to re-check your settings (Like creating a bundle).

I did notice that the bundle is only created when I hit Run, not when I compile.

tduccuong

  • New member
  • *
  • Posts: 7
Re: App doesn't show when run (MAC OS)
« Reply #5 on: January 25, 2019, 03:22:49 pm »
Problem solved!

Turns out there were few uncaught exceptions when starting the app. Sorry! My bad!

I ran into this because I am running Lazarus without gdb in MAC (it was so difficult to get it work in MAC - I tried many tutorials in the net, but always failed at installing + signing for gdb) --> no warning to be shown when exception arises. My actual development always in Linux where some env variables are different than MacOS --> execptions.

Hope this helps someone else too.

Trenatos

  • Hero Member
  • *****
  • Posts: 537
    • MarcusFernstrom.com
Re: App doesn't show when run (MAC OS)
« Reply #6 on: January 25, 2019, 04:36:19 pm »
Good that you got it working!

Have you tried lldb?
https://forum.lazarus.freepascal.org/index.php/topic,42869.0.html

I couldn't get GDB working on my Mac so I'm driving blind at the moment  :/

But I'll be giving lldb a solid chance this weekend, I hear good things!

tduccuong

  • New member
  • *
  • Posts: 7
Re: App doesn't show when run (MAC OS)
« Reply #7 on: January 25, 2019, 04:53:37 pm »
i haven't tried that (was too tired with MAC and I develop in Linux anyway). But if you get good result with lldb, please share with me too. I don't like flying blind either :-)

Thanks!

 

TinyPortal © 2005-2018