Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Qt Mac Deployment

Tags:

qt

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

like image 460
adviner Avatar asked Jun 27 '14 00:06

adviner


1 Answers

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.

like image 195
TheDarkKnight Avatar answered Oct 03 '22 08:10

TheDarkKnight