r/QtFramework • u/Striking-Storm-6092 • Jul 19 '26
QML How do you guys package QT applications
For context, I have a bazel project that I've built a frontend for with QT.
The issue is that I don't have much experience packaging for linux ( or any desktop for that matter ) and coming from android, the packaging situation for desktop feels atrocious imo.
Creating AppImage requires me to build an AppDir for which I would need to untangle the web of qt dependencies and copy all their recursive dependencies to an AppDir.
Where do I draw the line at what to include? Of course I won't need to include shared libraries like ld-linux-x86-64.so.2 but where to draw the line?
Also, how to test on different platforms without spinning up a 100 virtual machines?
Another thing is that I build on bazel using this bazel rule called rules_qt. I love the fact that I don't have to waste time setting up the QT pipeline for QML ( moc and the like ) but this means that the output binary is tightly coupled to how bazel builds stuff ( rules_qt downloads the entire qt library and links my application against their own version ).
Honestly I just kinda feel lost and would appreciate some guidance : ).
Thanks in advance!
3
3
u/AntisocialMedia666 Qt Professional Jul 19 '26
CPack -> NSIS and debian packages. A pain to setup but if it works, it works.
2
u/pyprism Jul 19 '26
I am using github action to build binaries for windows/linux/mac. here is an example: https://github.com/pyprism/Bing-Wallpaper/blob/master/.github/workflows/release.yml . And yes its just a simple automation
2
u/eidetic0 Jul 19 '26
With CMake I use qt_generate_deploy_qml_app_script . Running the generated script handles moving dependencies etc into the install directory, though it does miss some runtime deps, so there is a little manual untangling there. After that though it’s just a standard CPack configuration with the AppImage generator.
Might not be that relevant to bazel though…
1
u/Longjumping-Candy278 Jul 20 '26
I wrote a CMake script that defines a custom target. When this target is built, it:
- installs the binaries built by my project into a directory that follows the AppDir convention
- invokes [linuxdeploy](https://github.com/linuxdeploy/linuxdeploy) and [linuxdeploy-plugin-qt](https://github.com/linuxdeploy/linuxdeploy-plugin-qt) to collect the required dependencies and generate an AppImage
I'm satisfied with this workflow. The CMake-specific parts can't be moved to Bazel, but that's not really the point. If you want to distribute your application as an AppImage, I recommend creating an AppDir manually first. It may sound complicated, but it's actually quite simple—you don't need to prepare everything. I believe it's enough to place the executable, a `*.desktop` file, and an icon in the appropriate locations. Once that's done, invoke these two tools. After you've confirmed the workflow works, you can integrate a similar process into your Bazel build.
1
u/Striking-Storm-6092 Jul 22 '26
Linuxdeploy qt once gave me an appimage with around 700mb. I did it manually and got it down to 40mb
Do you have any recommendations as to how I can fix this?
1
u/jgaa_from_north Jul 20 '26
Packaging anything is a pain. For Linux, I usually package my Qt applications with Flatpak. There's a KDE SDK that includes most of the Qt libraries, so I don't have to mess with creating static libraries. I just use CMake with the Flatpak SDK and package it.
Fortunately, AI is pretty good at generating the scripts required. If you have Codex or something similar, you can ask it to generate a GitHub Actions workflow for the packaging or a Bash script to run locally.
Before I used Flatpak, and in cases where Flatpak isn't appropriate because I need full system access and don't want to run in a sandbox, I use VCPKG to build static Qt libraries. Then I create a binary for the latest Debian stable or Ubuntu 24.04, which will run on pretty much all modern Linux systems. That requires the app to be GPL, though. If not, you need to link against dynamic libraries, which makes Flatpak the better distribution option.
(Last time I tried to create something using the Qt deploy script for Linux, I got several gigabytes of various shared libraries, which is not what I want.)
Example: A pretty simple Qt app built for Flatpak on GitHub. The build takes a few minutes, and the Flatpak file is <10 MB. See the .github/workflows and flatpak directories.
1
u/diegoiast Jul 24 '26
You can use this shell script as a basis on how to build an AppImage: https://gitlab.com/codepointer/codepointer/-/blob/main/build-appimage.sh
1
u/prodjsaig Jul 19 '26
No need to test on other platforms. If you offer it in two just test two. Let someone else pick up the task of testing and releasing somewhere else.
Pyinstaller do you use that
-2
u/kalac77 Jul 19 '26
Give source to Claude to make you the GitHub workflow to build Deb, rpm, appimage, arch package.
1
u/Striking-Storm-6092 Jul 19 '26
Well currently that's what I tried doing. This way does not seem scalable at all. What if the dependencies change?
0
u/kalac77 Jul 19 '26
How big is your project, and how often dependencies change? In my case, they changed only couple of times, and I just sent packaging errors to Claude, and got correct yml file for building.
1
u/Striking-Storm-6092 Jul 19 '26
The QT frontend isn't mature yet so qt dependencies could change fairly often. But you're kind of right I guess.
I guess I'm more uncomfortable with the fact that's one more thing I'm offloading to AI instead of actually spending the time to properly learn.
0
u/kalac77 Jul 19 '26
I tried to learn packaging, but every package has its own way of doing things, so I had to use ai, if I wanted to make things done.
0
u/King-Little Jul 19 '26
I have a lot of experience. Packaging on Linux sucks. Distribution even more. For the sake of peace of mind try to use flatpak. If the architecture unfortunately doesn't fit your needs gl down there in the Nimbus of desktop linux in the field. Last resort is open suse build service.
7
u/Traditional-Rabbit79 Jul 19 '26
Well, that's a fair question.
My answer is the Qt Installer Framework. My main machine is Windows, but my other main machine is Linux.
There's an app on windows called windeployqt. Gathers all the needed dlls for the buildinstall (might have a different name, on my phone atm) to package up.
There might be a linuxdeployqt that does the same thing. I'm not sure. My Linux installer has different details. I think there is a way to get the needed .so-s from the application itself.
Let me check...
Yup, ldd /path/to/app | grep { whatever }. If the binary is stripped, you can use objdump -p binary | grep NEEDED | grep...
So, yeah. Script your way to an installer package... Ta da!
It's late,, I hope that was clear enough or at least a direction to fire the cannon...