Questions about DMG file not finding librares when trying to run an app
-
After a great deal of effort I produced a DMG from a pretty simple Qt app.
It won't run and I get this:Termination Reason: DYLD, [0x1] Library missing
Application Specific Information:
dyld: launch, loading dependent librariesDyld Error Message:
Library not loaded: @rpath/QtWidgets.framework/Versions/5/QtWidgets
Referenced from: /Volumes/VOLUME/MV01SW03.app/Contents/MacOS/MV01SW03
Reason: image not foundOff to DuckDuckGo and plenty of people with the same issue in all sorts of places.
otool seems to be the tool to tell you what's going on:
otool -L MV01SW03.app/Contents/MacOS/MV01SW03 MV01SW03.app/Contents/MacOS/MV01SW03: /System/Library/Frameworks/IOKit.framework/Versions/A/IOKit (compatibility version 1.0.0, current version 275.0.0) /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 1450.15.0) @rpath/QtWidgets.framework/Versions/5/QtWidgets (compatibility version 5.6.0, current version 5.6.3) @rpath/QtGui.framework/Versions/5/QtGui (compatibility version 5.6.0, current version 5.6.3) @rpath/QtCore.framework/Versions/5/QtCore (compatibility version 5.6.0, current version 5.6.3) /System/Library/Frameworks/DiskArbitration.framework/Versions/A/DiskArbitration (compatibility version 1.0.0, current version 1.0.0) /System/Library/Frameworks/OpenGL.framework/Versions/A/OpenGL (compatibility version 1.0.0, current version 1.0.0) /System/Library/Frameworks/AGL.framework/Versions/A/AGL (compatibility version 1.0.0, current version 1.0.0) /usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 400.9.0) /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1252.0.0)
And you then seem to have to check that DYLD_LIBRARY_PATH is right. It is set to:
/Users/robertw/Qt5.6.3/5.6.3/clang_64/lib
Does that look right? What is this @rpath thing? If all this is right when you run macdeplotqt does it or should it copy the libraries needed into the DMG? If I deploy on Windows I have to include libraries in the run directory so am guessing this is the same kind of thing? Only it's all trying to be a bit more under the hood?
Thanks.
-
Hi,
Did you use macdeployqt to creat your application bundle ?
It should have taken care of setting the search path correctly.
Apple's app bundle follow a pretty strict format, the non-system frameworks should be in the Frameworks folder which is one level above the executable folder. You indeed need to fix the entries for the Qt frameworks but as I wrote macdeployqt should be of great help for that. -
Morning. Yes, I did use macdeployqt. Sorry, I thought I'd written that in the post, my mistake.
When you say:
"the non-system frameworks should be in the Frameworks folder which is one level above the executable folder."
If I double click on the DMG it opens up a folder thingy (sorry am not a Mac user so don't really know the terminology) I can right click on what is in the folder when you double click on the DMG file and select show contents. The Frameworks folder holds four Qt*.framework files, Core, GUI, Printsupport and widgets.