Creating a installer for my QT program
-
Hello, I am trying to follow this tutorial by qt: https://doc.qt.io/qtinstallerframework/ifw-tutorial.html but I am confused at the "Creating Installer Content" Part. I have made my config.xml file and currently my layout is:
/camera
/packages
/config
config.xml
/com.vendor.product
/data
/metaWhen it says - "Content to be installed is stored in the data directory of a component. As there is only one component, place the data in the packages/com.vendor.product/data directory. The example already contains a file for testing purposes, but you can place basically any files in the directory." How exactly is this done? Where do I get the components to put in the data folder?
Also what needs to go into the packages and meta folders?
-
I see that, it was useful on how to do the package.xml and config, but I still unsure on how to properly do the data part. I see on this link at the bottom of the page https://doc.qt.io/qtinstallerframework/ifw-component-description.html#meta-directory It says you must package the data as a 7zip archive. I just am unsure of what exactly to be putting inside that zip.
-
@rtvideo said in Creating a installer for my QT program:
It says you must package the data as a 7zip archive
As far as I know, you don't need to do that.
The example doesn't do that, either.
You just put what you want to install, like exes and dlls.For example, if you want
[Target Dir] > [folder] > exe > dll
Then you should put
[com.vendor.product] > [data] > [folder] > exe > dll
-
@rtvideo
That doesn't have to use an installer.
If properly deployed, you can just pack the deploy folder to an archive file and copy the archive to other machine.
The key point here is deploying, not making an installer.
Making an installer still need you to deploy first, as I said, it doesn't care what you put in it. -
@rtvideo
Well, there is https://doc.qt.io/qt-5/deployment.html
For windows, in the Qt bin folder there is a tool named windeployqt.exe which can help to deploy.
I don't know if there is something like that in linux.
If you have problems about deployment in Linux, you can open a new topic. -
In my understanding (and I welcome corrections if I am mistaken),
windeployqt
andmacdeployqt
are "officially" or at least semi-officially supported/endorsed by Qt. On Linux, there exists a similar tool calledlinuxdeployqt
, but it is less official. Don't let that deter you, though. I have used it with ease and success, and in my experience it is quite solid and reliable.Their project: https://github.com/probonopd/linuxdeployqt
I am using
linuxdeployqt
in a public GitHub repo that you can examine if you find that sort of thing helpful.My script is here: https://github.com/219-design/qt-qml-project-template-with-ci/blob/0a696e808621/install_linux.sh
GitHub CI is active in my template project, so you can also go to "Actions" (the name GitHub uses for automated CI jobs) and examine as many raw logs of this running as you wish :)
There are 3 main parts to the script:
The first part creates a staging directory with an internal structure that is prescribed by linuxdeployqt. At the end of that first part, you have a directory that looks like this:
AppImage_staging/ └── usr ├── bin │ ├── app │ ├── event_filter.o │ ├── gui_tests.o │ ├── libapp.so │ ├── libapp.so.1 │ ├── libapp.so.1.0 │ ├── libapp.so.1.0.0 │ ├── liblibstylesplugin.so │ ├── libminutil.so │ ├── libminutil.so.1 │ ├── libminutil.so.1.0 │ ├── libminutil.so.1.0.0 │ ├── libtestmain.so │ ├── libtestmain.so.1 │ ├── libtestmain.so.1.0 │ ├── libtestmain.so.1.0.0 │ ├── lib_tests │ ├── libutil.so │ ├── libutil.so.1 │ ├── libutil.so.1.0 │ ├── libutil.so.1.0.0 │ ├── main.o │ ├── Makefile │ ├── moc_event_filter.cpp │ ├── moc_event_filter.o │ ├── moc_gui_tests.cpp │ ├── moc_gui_tests.o │ ├── moc_predefs.h │ └── view_model_collection.o ├── lib └── share ├── applications │ └── app.desktop └── icons └── hicolor └── 256x256 └── apps └── app.png
All the contents that were copied into AppImage_staging/usr/bin/ were produced during my build.
The contents of AppImage_staging/usr/share/, in contrast, are not artifacts of the build, but are rather supporting icons and supporting files that are committed in the git repository and rarely change.
The second part of the script (see line 37) uses
wget
to download an app image of linuxdeployqt itself. (In an admirable case of "dogfooding", the linuxdeployqt folks deploy their own software in app image format.)It isn't until the last command of the script that the 3rd and final task takes place.
Finally on line 51 we invoke linuxdeployqt.
After running linuxdeployqt, the staging folder is now "fully baked". It now contains a heck of a lot more libraries and other supporting files (in particular, QML files).
That folder can then be zipped or tarred (or just copied to an external USB drive), and you will be able to take that folder to any other Ubuntu 18 system and run the app regardless of whether "apt-get" versions of Qt have been installed on that system or not.
I have only needed to go so far as creating this "full baked" folder. However, if you want to produce a single-file app image, then just add the
-appimage
option when invoking linuxdeployqt. (My script does not add the -appimage option.) -
@KH-219Design Thank you for the detailed response, I have seen linuxdeploy before, but dont you need a very early release of Ubuntu for it to work for you? I think I tried with 18.04 a while back and it would not work.
-
@rtvideo said in Creating a installer for my QT program:
@KH-219Design Thank you for the detailed response, I have seen linuxdeployqt before, but dont you need a very early release of Ubuntu for it to work for you? I think I tried with 18.04 a while back and it would not work.
Historically that was the case. However, at some point they acquiesced to all the constant requests/pressure/bug-reporting and added the CLI option
-unsupported-allow-new-glibc
, which you can see being employed by me here.When you use that option,
linuxdeployqt
will emit this warning in the log, but otherwise everything proceeds just fine:2020-09-12T01:21:59.2440495Z WARNING: Not checking glibc on the host system. 2020-09-12T01:21:59.2440877Z The resulting AppDir or AppImage may not run on older systems.
My GitHub "Actions" that I mentioned earlier are running on the Ubuntu 18 GitHub runner.
-
@KH-219Design Okay great I will take a look over this and see if I can get it working as well, thank you!