Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Program won't start on macOS when using the .app
Forum Updated to NodeBB v4.3 + New Features

Program won't start on macOS when using the .app

Scheduled Pinned Locked Moved Unsolved General and Desktop
26 Posts 6 Posters 4.3k Views 5 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P PatrickKox

    Yes, It runs perfectly from QtCreator on mac (both the debug and release versions), in fact that's how I build the program on my mac.

    artwawA Offline
    artwawA Offline
    artwaw
    wrote on last edited by
    #13

    @PatrickKox I thought so much...

    It is absolutely odd, if the program would crash you should see system info that it crashed, with lots of data about it (often also with name of the method that caused the crash). When I think of it, this should also happen when one of the libraries is missing. Unless it is not crucial library...

    Simple way would be to put log messages into routines on entry, for example, that would log to the text file - this could give you at least some idea about where it dies. I think in the worst case you can log to the system console and then search through it but that's tedious work.

    For more information please re-read.

    Kind Regards,
    Artur

    P 1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #14

      Do you get the same issue with a default widget application ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      P 1 Reply Last reply
      0
      • artwawA artwaw

        @PatrickKox I thought so much...

        It is absolutely odd, if the program would crash you should see system info that it crashed, with lots of data about it (often also with name of the method that caused the crash). When I think of it, this should also happen when one of the libraries is missing. Unless it is not crucial library...

        Simple way would be to put log messages into routines on entry, for example, that would log to the text file - this could give you at least some idea about where it dies. I think in the worst case you can log to the system console and then search through it but that's tedious work.

        P Offline
        P Offline
        PatrickKox
        wrote on last edited by
        #15

        @artwaw

        How would I start it from the console?
        When I manually start it from application.app/Contents/MacOS/Application it runs fine.

        and when I double click or open from the filemanager the icon starts bouncing for a few seconds and nothing happens.

        The only way I can start from the GUI, is by right-clicking and selecting Show Package Content, and double click the executable in the Contents/MacOS directory.

        Could this indicate that macOS for some reason doesn't know what it must execute when I double-click the .app in Finder?

        artwawA 2 Replies Last reply
        0
        • P PatrickKox

          @artwaw

          How would I start it from the console?
          When I manually start it from application.app/Contents/MacOS/Application it runs fine.

          and when I double click or open from the filemanager the icon starts bouncing for a few seconds and nothing happens.

          The only way I can start from the GUI, is by right-clicking and selecting Show Package Content, and double click the executable in the Contents/MacOS directory.

          Could this indicate that macOS for some reason doesn't know what it must execute when I double-click the .app in Finder?

          artwawA Offline
          artwawA Offline
          artwaw
          wrote on last edited by
          #16

          @PatrickKox No no, I meant the Console, system application showing logs and stuff (cmd+space, "console"). I believe srterr ends up there, when you use system log. But I find it too troublesome to filter through stuff in it, so I just write to text file. It is lame but it works.

          For more information please re-read.

          Kind Regards,
          Artur

          P 1 Reply Last reply
          0
          • P PatrickKox

            @artwaw

            How would I start it from the console?
            When I manually start it from application.app/Contents/MacOS/Application it runs fine.

            and when I double click or open from the filemanager the icon starts bouncing for a few seconds and nothing happens.

            The only way I can start from the GUI, is by right-clicking and selecting Show Package Content, and double click the executable in the Contents/MacOS directory.

            Could this indicate that macOS for some reason doesn't know what it must execute when I double-click the .app in Finder?

            artwawA Offline
            artwawA Offline
            artwaw
            wrote on last edited by
            #17

            @PatrickKox Additionally, it might be gatekeeper stopping you from running unsigned code (that's the reason I asked do you sign the bundle).
            But on dev machine it should work, problem starts when you distribute the bundle. After you run it and it dies check system preferences -> security and privacy -> tab "general". It might be that there is an option where you have to allow this bundle to run (but gatekeeper should also display a warning and notification that you run "potentially dangerous code").

            For more information please re-read.

            Kind Regards,
            Artur

            1 Reply Last reply
            0
            • SGaistS SGaist

              Do you get the same issue with a default widget application ?

              P Offline
              P Offline
              PatrickKox
              wrote on last edited by
              #18

              @SGaist
              No, a blank Widget app works without any problem.

              1 Reply Last reply
              0
              • artwawA artwaw

                @PatrickKox No no, I meant the Console, system application showing logs and stuff (cmd+space, "console"). I believe srterr ends up there, when you use system log. But I find it too troublesome to filter through stuff in it, so I just write to text file. It is lame but it works.

                P Offline
                P Offline
                PatrickKox
                wrote on last edited by PatrickKox
                #19

                @artwaw
                Ah, Sorry I thought you were talking about the terminal (since some people also refer to it as the console).

                Anyway, It seems to give a SegFault when I start it.

                Process:               HoofdpijnAgenda [5166]
                Path:                  /Volumes/*/HoofdpijnAgenda.app/Contents/MacOS/HoofdpijnAgenda
                Identifier:            com.yourcompany.HoofdpijnAgenda
                Version:               0
                Code Type:             X86-64 (Native)
                Parent Process:        bash [5160]
                Responsible:           Terminal [3369]
                User ID:               501
                
                Date/Time:             2021-09-27 20:57:19.111 +0200
                OS Version:            macOS 11.5.2 (20G95)
                Report Version:        12
                Anonymous UUID:        8E37DB9C-E5D3-B90F-44FA-F8CA1022523D
                
                Sleep/Wake UUID:       D133E950-78B6-472C-A3AF-10A530D9F01D
                
                Time Awake Since Boot: 8100 seconds
                Time Since Wake:       5200 seconds
                
                System Integrity Protection: enabled
                
                Crashed Thread:        0  Dispatch queue: com.apple.main-thread
                
                Exception Type:        EXC_BAD_ACCESS (SIGSEGV)
                Exception Codes:       KERN_INVALID_ADDRESS at 0x0000000000000000
                Exception Note:        EXC_CORPSE_NOTIFY
                
                Termination Signal:    Segmentation fault: 11
                Termination Reason:    Namespace SIGNAL, Code 0xb
                Terminating Process:   exc handler [5166]
                

                But why does it work when started from QtCreator or the terminal?

                edit:
                wait... This is when it actually runs (Terminal and QtCreator), when I start from Finder, there is nothing added to Console (at least not to the crash reports)

                I do however see this

                Sep 28 21:27:47 Patricks-MacBook-Air com.apple.xpc.launchd[1] (application.com.yourcompany.HoofdpijnAgenda.12886989148.12886989233[16445]): Service exited with abnormal code: 1
                
                artwawA 1 Reply Last reply
                0
                • P PatrickKox

                  @artwaw
                  Ah, Sorry I thought you were talking about the terminal (since some people also refer to it as the console).

                  Anyway, It seems to give a SegFault when I start it.

                  Process:               HoofdpijnAgenda [5166]
                  Path:                  /Volumes/*/HoofdpijnAgenda.app/Contents/MacOS/HoofdpijnAgenda
                  Identifier:            com.yourcompany.HoofdpijnAgenda
                  Version:               0
                  Code Type:             X86-64 (Native)
                  Parent Process:        bash [5160]
                  Responsible:           Terminal [3369]
                  User ID:               501
                  
                  Date/Time:             2021-09-27 20:57:19.111 +0200
                  OS Version:            macOS 11.5.2 (20G95)
                  Report Version:        12
                  Anonymous UUID:        8E37DB9C-E5D3-B90F-44FA-F8CA1022523D
                  
                  Sleep/Wake UUID:       D133E950-78B6-472C-A3AF-10A530D9F01D
                  
                  Time Awake Since Boot: 8100 seconds
                  Time Since Wake:       5200 seconds
                  
                  System Integrity Protection: enabled
                  
                  Crashed Thread:        0  Dispatch queue: com.apple.main-thread
                  
                  Exception Type:        EXC_BAD_ACCESS (SIGSEGV)
                  Exception Codes:       KERN_INVALID_ADDRESS at 0x0000000000000000
                  Exception Note:        EXC_CORPSE_NOTIFY
                  
                  Termination Signal:    Segmentation fault: 11
                  Termination Reason:    Namespace SIGNAL, Code 0xb
                  Terminating Process:   exc handler [5166]
                  

                  But why does it work when started from QtCreator or the terminal?

                  edit:
                  wait... This is when it actually runs (Terminal and QtCreator), when I start from Finder, there is nothing added to Console (at least not to the crash reports)

                  I do however see this

                  Sep 28 21:27:47 Patricks-MacBook-Air com.apple.xpc.launchd[1] (application.com.yourcompany.HoofdpijnAgenda.12886989148.12886989233[16445]): Service exited with abnormal code: 1
                  
                  artwawA Offline
                  artwawA Offline
                  artwaw
                  wrote on last edited by
                  #20

                  @PatrickKox said in Program won't start on macOS when using the .app:

                  Exception Type: EXC_BAD_ACCESS (SIGSEGV)
                  Exception Codes: KERN_INVALID_ADDRESS at 0x0000000000000000
                  Exception Note: EXC_CORPSE_NOTIFY

                  Termination Signal: Segmentation fault: 11
                  Termination Reason: Namespace SIGNAL, Code 0xb
                  Terminating Process: exc handler [5166]

                  It does end with segfault.

                  For more information please re-read.

                  Kind Regards,
                  Artur

                  1 Reply Last reply
                  0
                  • S Offline
                    S Offline
                    SimonSchroeder
                    wrote on last edited by
                    #21

                    How do you run the program from the terminal? Do run the executable inside Contents/MacOS? Or do you type open MyApp.app?

                    If it is about not signing your app like @artwaw suggested, there is a difference to opening the app by just clicking on it (which will then not work) and doing a right click and selecting Open from the context menu.

                    P 1 Reply Last reply
                    0
                    • S SimonSchroeder

                      How do you run the program from the terminal? Do run the executable inside Contents/MacOS? Or do you type open MyApp.app?

                      If it is about not signing your app like @artwaw suggested, there is a difference to opening the app by just clicking on it (which will then not work) and doing a right click and selecting Open from the context menu.

                      P Offline
                      P Offline
                      PatrickKox
                      wrote on last edited by
                      #22

                      @SimonSchroeder
                      I run the executable in Contents/MacOS, when I use open MyApp.app it just ends without any message.

                      I've also tried to sign the app but that doesn't help.

                      1 Reply Last reply
                      0
                      • artwawA Offline
                        artwawA Offline
                        artwaw
                        wrote on last edited by
                        #23

                        Out of curiosity, are you able to create fresh, new, simple program (can be just main window, empty), compile it, macdeployqt-it and run without any issues? Just to check if it is something particular to your main project that fails or the problem is in the environment itself?

                        For more information please re-read.

                        Kind Regards,
                        Artur

                        1 Reply Last reply
                        0
                        • JoeCFDJ Offline
                          JoeCFDJ Offline
                          JoeCFD
                          wrote on last edited by JoeCFD
                          #24

                          use dtruss to run your app to see what is missing. QtCreator has its own env settings. If your app can not be started, that means some env settings are missing. dtruss may be able to tell what.

                          1 Reply Last reply
                          0
                          • P Offline
                            P Offline
                            PatrickKox
                            wrote on last edited by
                            #25

                            @artwaw
                            The blank project works fine, I don't even need to execute macdeployqt on it for it to work. So it's not my build environment.

                            @JoeCFD
                            dtruss returns a massive list of information, is there something I can grep at? Most information looks like memory addresses?

                            JoeCFDJ 1 Reply Last reply
                            0
                            • P PatrickKox

                              @artwaw
                              The blank project works fine, I don't even need to execute macdeployqt on it for it to work. So it's not my build environment.

                              @JoeCFD
                              dtruss returns a massive list of information, is there something I can grep at? Most information looks like memory addresses?

                              JoeCFDJ Offline
                              JoeCFDJ Offline
                              JoeCFD
                              wrote on last edited by
                              #26

                              @PatrickKox if a lib or plugin is missing, you may be able to see it. Pipe the output into a file.
                              and you can do the same thing by running the build with qtcreator which runs well. Then you can compare both output and may be able to find some hints.

                              1 Reply Last reply
                              0

                              • Login

                              • Login or register to search.
                              • First post
                                Last post
                              0
                              • Categories
                              • Recent
                              • Tags
                              • Popular
                              • Users
                              • Groups
                              • Search
                              • Get Qt Extensions
                              • Unsolved