5

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:

enter image description here

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:

enter image description here

I get crypto and qscintilla path but shouldnt the Qt framework also follow the same pattern? Its still pointing to the original path

1 Answer 1

9

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.

1
  • 1
    Wow this saved me the headache. Thank you for the information
    – adviner
    Jun 27, 2014 at 13:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.