Qt noob here.
I've programmed a little GUI application to accomplish a menial task on Qt Creator for Linux (Ubuntu 22.04). It consists of very few classes and a basic user interface.
I'd like to handout a self-contained executable file for a colleague to use on his Windows machine, but I can't find any idiot-proof instructions on how to do it.
Here's a screenshot of an autogenerated directory of the project build:
How do I go from here? What tools do I need?
CodePudding user response:
If you want a single file you need to link Qt libraries statically to your executable, and also if you want to let your colleague use it onw indows you either need to cross-compile it or to compile it natively on windows machine.
CodePudding user response:
The answer to this question is "a commercial Qt license".
Your goal is to have a self-contained executable, which implies that this executable contains your code and that of Qt. However, the Qt library is dual-licensed, and the open source license used is LGPLv3.
The obligations that follow from this license can be read in the Qt FAQ:
- You will need to deliver the complete source code of Qt libraries you used, including all modifications you did or applied, to your users/customers. Alternatively, you need to provide a written offer with instructions on how to get the source code. Please also note that this has to be under your control, so a link to the source code provided by the Qt Project or Qt Company is not sufficient.
- The user of your application has to be able to re-link your application against a different or modified version of the Qt library. With LGPLv3 it is also explicitly stated that the user needs to be able to run the re-linked binary on its intended target device. It is your obligation to provide the user with all necessary tools to enable this process. For embedded devices, this includes making the full toolchain used to compile the library available to users. For parts licensed under LGPLv3 you are obliged to provide full instructions on how to install the modified library on the target device (this is not clearly stated with LGPLv2.1, although running the application against the modified version of the library clearly is the stated intention of the license).
- The user of an application or device using LGPL licensed software has to be notified of their rights by providing a copy of the LGPL license to the end user and displaying a prominent notice about your usage of LGPL licensed software.
Shipping a single executable violates obligations 1 and 3, but this is relatively easy to fix by adding the required files. However, obligation 2 is not. The process used to create a single self-contained executable is not easily reversible. It might be possible to meet this obligation by also shipping the source code, but please consult a software lawyer to properly interpret the license text.