Solved QtAssistant inside own Application bundle
-
Hi
I am trying to get my crossplatform application to also bundle the QtAssistant for Mac, Linux and Windows.
The QtAssistant in my application works fine under Linux and Windows, but under Mac it isn't starting.
I used the version delivered in Qt 5.7, but it crashes immediately the error is:Library not loaded QtHelp
Reason: image not foundBut the QtHelp library is available in the Frameworks folder inside the QtAssistant.app bundle.
I get the same error when I compiled my own version of the QtAssistant and used 'macdeployqt' to fix all the dependencies.
Is there someone who can help me to fix this problem?Kind regards,
Koen
-
Nevermind, reinstalling Qt 5.7.0 fixed the problem for me.
I guess the QtHelp library was corrupt or something.Although it would be nice if only the Assistant executable could be in the bundle instead of the complete Assistant bundle.
Because then there are two Framework folders containing Qt Libraries.
Anyone know's how to do that? -
This is the guide to get the Assitant as a executable instead of a full bundle inside your own application bundle:
-
Copy the Assistant executable in your own Application bundle in the MacOs folder.
-
Change the rpath to link to the Framework directory:
install_name_tool -add_rpath '@loader_path/../Frameworks' YOUR_APPLICATION.app/Contents/MacOS/Assistant -
Run the macdeployqt on your Application but also with this command:
macdeployqt YOUR_APPLICATION.app -dmg -always-overwrite -executable=YOUR_APPLICATION.app/Contents/MacOS/Assistant
Note: The -dmg tag is optional, please test it first without the parameter.
- Please make sure the Frameworks directory contains the following files:
@rpath/QtHelp.framework/Versions/5/QtHelp @rpath/QtWidgets.framework/Versions/5/QtWidgets @rpath/QtGui.framework/Versions/5/QtGui @rpath/QtCore.framework/Versions/5/QtCore /System/Library/Frameworks/DiskArbitration.framework/Versions/A/DiskArbitration /System/Library/Frameworks/IOKit.framework/Versions/A/IOKit @rpath/QtPrintSupport.framework/Versions/5/QtPrintSupport @rpath/QtNetwork.framework/Versions/5/QtNetwork @rpath/QtSql.framework/Versions/5/QtSql /System/Library/Frameworks/OpenGL.framework/Versions/A/OpenGL /System/Library/Frameworks/AGL.framework/Versions/A/AGL /usr/lib/libc++.1.dylib /usr/lib/libSystem.B.dylib
-
You can check where the rpath is leading with the following command:
otool -l YOUR_APPLICATION.app/Contents/MacOs/Assistant -
Make sure it returns this item:
Load command 28 cmd LC_RPATH cmdsize 40 path @loader_path/../Frameworks (offset 12)
- It's possible to have multiple LC_RPATH, so don't worry if there are also others.
-