Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Deploying QT app on OS X and linux

Whats the best way to deploy a QT app? I've read the documentation hosted at trolltech but is it better to link with a static library or the dynamic libraries and have the user install the framework? I don't really want anyone using my app to have to download a 160mb framework just to run a simple gui frontend.

like image 924
whatWhat Avatar asked Feb 27 '23 16:02

whatWhat


1 Answers

On OS X it's a good way to do a dynamic build and post-process the resulting ".app" with the macdeployqt tool which comes with Qt starting with 4.5.

This will copy the Qt frameworks used by your application into the application bundle, which results in a larger package than building a static version of your application.

Here is what you can do to make sure you get the smallest file size possibly in a dynamic build:

  • First off, make sure you only include the stuff you need (in the project.pro file's QT += core gui network xml lines).
  • Open the application bundle and remove any unneeded "Qt Plugins" from the bundle. macdeployqt automatically compies all the Qt plugins in there, which can be kind of bulky.
  • Make sure you are building your application in release mode. Otherwise your application might be linked against the debug libraries of the Qt4 framework, and they are really big (for instance, well over 90 MB for the debug library vs. 16 MB of a release variant without debugging symbols). This might be what happened in your case.
  • If you have a large application binary, you can use UPX to compress your executable file by 40-50%.

Other than that, you should use compressed disk images to deploy your application.

One of my projects uses QtGui, QtNetwork, QtCore and QtXml and the resulting bundle is about 16 MB in size.

Hope that helps.

like image 175
BastiBen Avatar answered Mar 07 '23 09:03

BastiBen