Adding QT Framework into my .app bundle
Im following the documentation on Qt site on Deployment. I created an app is named HTTPClient.app
I created the Framework folder under the Contents and copied crypto++ and qscintilla and Qt frameworks and it looks like this:
then i run install_name_tool -id -change
DylibFile=libqscintilla2.11.dylib
install_name_tool -id @executable_path/../Frameworks/$DylibFile $ProjectName.app/Contents/Frameworks/$DylibFile
install_name_tool -change $DylibFile @executable_path/../Frameworks/$DylibFile $ProjectName.app/Contents/MacOS/$ProjectName
and the same for crypto++. I did the following to the Qt Frameworks
DylibFile=QtCore.framework/Versions/5/QtCore
install_name_tool -id @executable_path/../Frameworks/$DylibFile $ProjectName.app/Contents/Frameworks/$DylibFile
install_name_tool -change $DylibFile @executable_path/../Frameworks/$DylibFile $ProjectName.app/Contents/MacOS/$ProjectName
DylibFile=QtWidgets.framework/Versions/5/QtWidgets
install_name_tool -id @executable_path/../Frameworks/$DylibFile $ProjectName.app/Contents/Frameworks/$DylibFile
install_name_tool -change $DylibFile @executable_path/../Frameworks/$DylibFile $ProjectName.app/Contents/MacOS/$ProjectName
DylibFile=QtGui.framework/Versions/5/QtGui
install_name_tool -id @executable_path/../Frameworks/$DylibFile $ProjectName.app/Contents/Frameworks/$DylibFile
install_name_tool -change $DylibFile @executable_path/../Frameworks/$DylibFile $ProjectName.app/Contents/MacOS/$ProjectName
DylibFile=QtSql.framework/Versions/5/QtSql
install_name_tool -id @executable_path/../Frameworks/$DylibFile $ProjectName.app/Contents/Frameworks/$DylibFile
install_name_tool -change $DylibFile @executable_path/../Frameworks/$DylibFile $ProjectName.app/Contents/MacOS/$ProjectName
DylibFile=QtNetwork.framework/Versions/5/QtNetwork
install_name_tool -id @executable_path/../Frameworks/$DylibFile $ProjectName.app/Contents/Frameworks/$DylibFile
install_name_tool -change $DylibFile @executable_path/../Frameworks/$DylibFile $ProjectName.app/Contents/MacOS/$ProjectName
Now when I run otool i get the following:
I get crypto and qscintilla path but shouldnt the Qt framework also follow the same pattern? Its still pointing to the original path
You can save yourself time worrying about how to use install_name_tool
with Qt Frameworks by using the provided tool macdeployqt, which is located in the bin folder of your Qt installation.
This tool will copy the required Qt libraries and set the paths accordingly. So, assuming you've got the Qt bin folder in your path, all you need to do is call this: -
macdeployqt HTTPClient.app
Note that it only deals with the Qt Framework, so you must still handle the others yourself.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With