Program won't start on macOS when using the .app
-
The dependencies for GUI, SQL (I use SQLite3 not Postgres SQL), Widget, Core, Chart and some others are inside the Framework directory.
The output from macdeployqy with -verbose=3 is huge, so I'll look into that during the weekend when I have more time.
But when I run using the export CYLD_PRINT_LIBRARIES_POST_LAUNCH=1 option, I notice several libraries are loaded from /System and not the app folder:
$ ./HoofdpijnAgenda dyld: loaded: <CDEE5153-12AA-3A16-9077-D54E0733DB25> /System/Library/PrivateFrameworks/CoreServicesInternal.framework/Versions/A/CoreServicesInternal dyld: loaded: <561E6824-17F0-313C-B470-00FD08F0C8DD> /Users/patrickkox/Documents/GitHub/Hoofdpijn-Agenda/build-HoofdpijnAgenda-Qt_6_1_3_for_macOS-Release/HoofdpijnAgenda.app/Contents/PlugIns/platforms/libqcocoa.dylib dyld: loaded: <FEFBAFBF-EE76-3E63-84CA-95E5F1F26805> /usr/lib/libobjc-trampolines.dylib dyld: loaded: <87F799AF-A8B9-31FB-9885-7EBDAEBCECC3> /System/Library/Frameworks/FileProvider.framework/Versions/A/FileProvider dyld: loaded: <D3091C11-4823-34D7-829D-DBA3C7616DE1> /System/Library/Frameworks/Accounts.framework/Versions/A/Accounts dyld: loaded: <623FEAF8-671F-3812-9EA4-7B30FFC4AE7D> /System/Library/PrivateFrameworks/GenerationalStorage.framework/Versions/A/GenerationalStorage dyld: loaded: <CE5694DC-0351-3F11-8850-19A9AB721893> /System/Library/PrivateFrameworks/CoreSymbolication.framework/Versions/A/CoreSymbolication dyld: loaded: <DC724AF6-1C92-3913-B6A7-0AA062AE1792> /System/Library/PrivateFrameworks/SymptomDiagnosticReporter.framework/Versions/A/SymptomDiagnosticReporter dyld: loaded: <FD2F7A55-6308-3495-BC07-A74DDB8F57C9> /System/Library/PrivateFrameworks/DesktopServicesPriv.framework/Versions/A/DesktopServicesPriv dyld: loaded: <37533D5B-1AC4-3E2F-B29B-F33D0C463F49> /usr/lib/libsandbox.1.dylib dyld: loaded: <209049A9-BA50-336B-B43E-050998B5E33D> /System/Library/PrivateFrameworks/UserManagement.framework/Versions/A/UserManagement dyld: loaded: <DAEF912D-F2E6-34E7-B93C-708A6CCE0F7E> /System/Library/PrivateFrameworks/MobileKeyBag.framework/Versions/A/MobileKeyBag dyld: loaded: <95D77D1F-5373-3C85-BA2A-48923BA260FA> /System/Library/PrivateFrameworks/ChunkingLibrary.framework/Versions/A/ChunkingLibrary dyld: loaded: <A0FA2F40-271B-3CC7-8083-A34E21093536> /System/Library/PrivateFrameworks/DebugSymbols.framework/Versions/A/DebugSymbols dyld: loaded: <D3B2F86B-1440-3F86-863D-521EFB5E6BF8> /System/Library/PrivateFrameworks/Sharing.framework/Versions/A/Sharing dyld: loaded: <E1BB392A-D496-383C-9B5A-08D695D14FD9> /System/Library/PrivateFrameworks/Apple80211.framework/Versions/A/Apple80211 dyld: loaded: <92FFE128-151C-33EB-9179-234F9F976F32> /System/Library/PrivateFrameworks/AuthKit.framework/Versions/A/AuthKit dyld: loaded: <5B68EF6B-DE46-36B1-8928-111D92C948CD> /System/Library/PrivateFrameworks/CoreUtils.framework/Versions/A/CoreUtils dyld: loaded: <17C7352E-2EF3-36BE-8BF9-B9AF2541B02D> /System/Library/Frameworks/CoreWLAN.framework/Versions/A/CoreWLAN dyld: loaded: <E5F9D822-9999-3521-A812-6ED6E4B4F7C3> /System/Library/Frameworks/IOBluetooth.framework/Versions/A/IOBluetooth dyld: loaded: <30F0EC33-A723-3637-BAEE-746E62173413> /System/Library/PrivateFrameworks/CoreWiFi.framework/Versions/A/CoreWiFi dyld: loaded: <16382BEE-19B6-3AE5-B450-D037B7D7C19F> /System/Library/PrivateFrameworks/CorePhoneNumbers.framework/Versions/A/CorePhoneNumbers dyld: loaded: <2D63F3D0-8E51-3337-8EB7-A774020B129C> /System/Library/PrivateFrameworks/DiskManagement.framework/Versions/A/DiskManagement dyld: loaded: <A3631052-9D44-308F-BF87-E501AB409692> /System/Library/PrivateFrameworks/AppleIDAuthSupport.framework/Versions/A/AppleIDAuthSupport dyld: loaded: <B1E75E61-0B7E-3036-931E-4D0C8E6307FC> /System/Library/PrivateFrameworks/KeychainCircle.framework/Versions/A/KeychainCircle dyld: loaded: <5198B786-444D-3CA6-85AC-6555688B0DBC> /System/Library/PrivateFrameworks/MediaKit.framework/Versions/A/MediaKit dyld: loaded: <367204EF-650E-36BE-8D0F-9DF6E79E5DB0> /System/Library/Frameworks/DiscRecording.framework/Versions/A/DiscRecording dyld: loaded: <D84C72BA-171F-37D1-9099-294DF04347A2> /usr/lib/libCoreStorage.dylib dyld: loaded: <7D24C26A-8165-33ED-8255-43B52148CD29> /usr/lib/libcsfde.dylib dyld: loaded: <87EAE8D8-A80C-3BE3-87EF-A1AA20876D7F> /System/Library/PrivateFrameworks/ProtectedCloudStorage.framework/Versions/A/ProtectedCloudStorage dyld: loaded: <B6D754F1-9575-3000-BF81-55B0B7A83804> /System/Library/PrivateFrameworks/EFILogin.framework/Versions/A/EFILogin dyld: loaded: <097C1991-EEC4-374E-A686-826E479A2A07> /System/Library/Frameworks/AudioUnit.framework/Versions/A/AudioUnit dyld: loaded: <1A427F92-B95A-3077-853B-09688553DA70> /System/Library/Frameworks/CoreBluetooth.framework/Versions/A/CoreBluetooth dyld: loaded: <0391A7F9-5CAD-399A-92E4-5B1A4A2DED43> /usr/lib/libMatch.1.dylib dyld: loaded: <D5D0AD69-E651-3BE2-B87A-4A035DCD9DBF> /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vImage.framework/Versions/A/Libraries/libCGInterfaces.dylib dyld: loaded: <8A59B9FA-55F7-325B-9801-88342C26A8D7> /Users/patrickkox/Documents/GitHub/Hoofdpijn-Agenda/build-HoofdpijnAgenda-Qt_6_1_3_for_macOS-Release/HoofdpijnAgenda.app/Contents/PlugIns/styles/libqmacstyle.dylib dyld: loaded: <B18084DB-3288-345F-8E7E-A157971C196B> /Users/patrickkox/Documents/GitHub/Hoofdpijn-Agenda/build-HoofdpijnAgenda-Qt_6_1_3_for_macOS-Release/HoofdpijnAgenda.app/Contents/PlugIns/sqldrivers/libqsqlite.dylib Databestand hoofdpijnen.sqlite3 geopend. QSqlDatabasePrivate::removeDatabase: connection 'qt_sql_default_connection' is still in use, all queries will cease to work. dyld: loaded: <A1880566-53BD-3F97-8F4A-0D8B5D04FC8F> /Users/patrickkox/Documents/GitHub/Hoofdpijn-Agenda/build-HoofdpijnAgenda-Qt_6_1_3_for_macOS-Release/HoofdpijnAgenda.app/Contents/PlugIns/imageformats/libqjpeg.dylib dyld: loaded: <6FD6B5FC-A78E-357E-8CDB-69D06595B0BE> /System/Library/PrivateFrameworks/login.framework/Versions/A/login Databestand hoofdpijnen.sqlite3 geopend. dyld: loaded: <E03494F6-D023-376D-8177-7600A8CF6873> /System/Library/PrivateFrameworks/ViewBridge.framework/Versions/A/ViewBridge dyld: loaded: <D700B323-61F9-35B6-83DC-4D272DAFEB50> /System/Library/PrivateFrameworks/CrashReporterSupport.framework/Versions/A/CrashReporterSupport dyld: loaded: <B1623916-5735-37BC-B424-0EFAD8662D74> /System/Library/PrivateFrameworks/OSAnalytics.framework/Versions/A/OSAnalytics dyld: loaded: <A7FFAFB5-B0AB-312E-8EB6-FAF56D76FB7D> /usr/lib/libRosetta.dylib dyld: loaded: <42D309FD-1717-3D9C-A5F7-EE9FAF163162> /System/Library/PrivateFrameworks/RemoteServiceDiscovery.framework/Versions/A/RemoteServiceDiscovery dyld: loaded: <3A006E5D-FE72-3D34-B887-4EF7824B5A4B> /System/Library/PrivateFrameworks/Symbolication.framework/Versions/A/Symbolication dyld: loaded: <BBD3F65B-90E9-3107-A8E8-81D708226D26> /System/Library/PrivateFrameworks/MallocStackLogging.framework/Versions/A/MallocStackLogging dyld: loaded: <06BB02D5-50F4-359B-AA41-42D08FE267CD> /System/Library/PrivateFrameworks/AccessibilityBundles.framework/Versions/A/AccessibilityBundles dyld: unloaded: <A1880566-53BD-3F97-8F4A-0D8B5D04FC8F> /Users/patrickkox/Documents/GitHub/Hoofdpijn-Agenda/build-HoofdpijnAgenda-Qt_6_1_3_for_macOS-Release/HoofdpijnAgenda.app/Contents/PlugIns/imageformats/libqjpeg.dylib dyld: unloaded: <561E6824-17F0-313C-B470-00FD08F0C8DD> /Users/patrickkox/Documents/GitHub/Hoofdpijn-Agenda/build-HoofdpijnAgenda-Qt_6_1_3_for_macOS-Release/HoofdpijnAgenda.app/Contents/PlugIns/platforms/libqcocoa.dylib dyld: unloaded: <B18084DB-3288-345F-8E7E-A157971C196B> /Users/patrickkox/Documents/GitHub/Hoofdpijn-Agenda/build-HoofdpijnAgenda-Qt_6_1_3_for_macOS-Release/HoofdpijnAgenda.app/Contents/PlugIns/sqldrivers/libqsqlite.dylib dyld: unloaded: <8A59B9FA-55F7-325B-9801-88342C26A8D7> /Users/patrickkox/Documents/GitHub/Hoofdpijn-Agenda/build-HoofdpijnAgenda-Qt_6_1_3_for_macOS-Release/HoofdpijnAgenda.app/Contents/PlugIns/styles/libqmacstyle.dylib
-
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.
-
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.
@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.
-
Do you get the same issue with a default widget application ?
-
@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.
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?
-
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?
@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.
-
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?
@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"). -
@SGaist
No, a blank Widget app works without any problem. -
@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.
@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
-
@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
@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_NOTIFYTermination Signal: Segmentation fault: 11
Termination Reason: Namespace SIGNAL, Code 0xb
Terminating Process: exc handler [5166]It does end with segfault.
-
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.
-
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.
@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.
-
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?
-
-
@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.