Example QtWidgetsApplication packed as AppImage using

In a previous [post]({% post_url 2019-05-03-appimage-dependencies-management %}) was mentioned how well and AppImage could work in order to ease the production and distribution of your software. In this post, we show a minimal example of how to pack a Qt Widgets Application as an AppImage using as a dependencies management system.

What’s Conan? it’s a decentralized package manager. That allows us to have binaries ready to be used to create AppImages.

Why do you need such special binaries? In order to create an application that could be run on almost any GNU/Linux distribution you will need to build your application and it’s dependencies on a very old base system (by example Centos 6). So you will have to back-port every dependency to such system. Using our repository you can access to a wide range of package recipes that are ready to be built/used on almost any distribution. Such packages are available on bintray and the recipes are on github You will find them as part of the appimage-conan-community which is a group for those using this technology stack.

The Code

Let’s take a minimal Qt Widgets applications which uses qmake as build system. Then we will add a desktop file and an icon. Finally, we will declare our project dependencies using a conanfile.txt.


# linuxdeploy is required to build the AppImage therefore is listed only as build require

# allow to run qmake from the build dir
# create conan virtual environment (required to run linuxdeploy)

# Require shared libs

Now we can proceed building our AppImage:

mkdir build && cd build;

# Install conan dependencies requiring them to be built using c++ 11 and linked to libstdc++11  
conan install .. -s compiler.cppstd=11 -s compiler.libcxx=libstdc++11 --build missing

# Enter conan virtual environment (just like python virtual environments)

# build your app as your are used to
qmake CONFIG+=release PREFIX=/usr ../

# Let's crete the AppImage
# install you app to an AppDir
INSTALL_ROOT=$BUILD_DIR/AppDir make install

# call linuxdeploy with the Qt plugin
linuxdeploy --appdir AppDir/ --plugin qt --output appimage

# exit conan virtual env

You can find the whole project code on Github.

Please fell free to leave your comments below and enjoy hacking!

Licensed under CC BY-NC-SA 4.0
Built with Hugo
Theme Stack designed by Jimmy