3

I wrote a Qt C++ application and want to deploy it on Windows, OSX and Linux. The problem is, it only works on machines where Qt is installed.

How would I make it work on computers that don't have Qt? Do I have to install it with an application setup or something? I don't get the whole linking thing.

frogatto
  • 28,539
  • 11
  • 83
  • 129
rettetdemdativ
  • 369
  • 5
  • 16

5 Answers5

5

There is nice tools for prepare application for distribution. Its macdeployqt for OSX and windeployqt for Windows. They copy all dependencies into application folder, so you can just copy that folder to another machine. For linux you need create package. This specific for different linux version. Read more about deployment here

Evgeny
  • 3,910
  • 2
  • 20
  • 37
  • Thank you for your answer. I didn't know it was necessary to do this. So for Windows and OSX i use the deployment tools to copy all the dependencies into the directory and then create a setup. On Linux I'd use the tool to find all available dependencies, link to them when compiling and then declare them dependencies in the package. Is that correct? – rettetdemdativ Jan 11 '16 at 13:01
3

On Windows, you are encouraged to distribute the Qt DLL files with your application. Just put them in the same folder as your executable file in the installation files.

ypnos
  • 50,202
  • 14
  • 95
  • 141
2

Under Linux you can use package system (see RPM, or deb package)

For Windows, you juste need to include the .ddl files with the executable (and why not compact it into an installer (see Easysetup tool)

Pierre
  • 1,162
  • 12
  • 29
1

I can't speak for Windows but Linux systems have a package management system that checks for required dependencies so it all gets dealt with by the package management system on installation. You just have to produce the installation package for each distro you wish to support, although many distros will accept the same package due to similarities.

See Building an RPM

Also: Debian Packaging

Those are two popular package systems used by Linux distributions..

Galik
  • 47,303
  • 4
  • 80
  • 117
1

For Windows the answers of Pierre and ypnos are fine. I would add to change "are encouraged" into must as this is the only way to escape the dll hell. Using an installer has as disadvantage that the user installing your application needs Administrator rights. Just zipping the whole application dir and supplying users with that zip file is enough for getting it running on any Windows client computer.

For Linux see my answer on another Stackoverflow question. The solution I give works works basically on any Linux distro. You copy all your dependencies to the application dir and get your application running by starting a shell script that first sets LD_LIBRARY_PATH. If you have that script also creating a Linux desktop file your users can from then on double click that desktop file. Running your app will then be transparent to your user. Many major Linux GUI applications (like Google's chrome) are started from a desktop file. The roundabout of the script is necessary because the desktop file has the application dir in it hardcoded and you cannot predict where your users want to deploy your application. Using package managers is not that simple. In addition there are on the order of twenty different package managers for Linux.

For OSX you can try to use the Qt utility macdeployqt. We always had problems with that utility. We do it ourselves with a qmake script. You tell Qt Creator to make an app_bundle. I have described somewhere else how to digitally sign a OSX Qt app. Part of the signing requires the app to be standalone. You can read that part of my answer. If you separate the deploy script from the main pro file you can reuse that script for all your OSX applications.

Community
  • 1
  • 1
adlag
  • 1,016
  • 9
  • 19