Create a Flatpak package for my Qt app
Solved
Installation and Deployment
-
Hello, I try to create a Flatpak package for my application
Here is what I did so far
flatpak remote-add --user --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo flatpak install --user org.kde.Sdk (select 5.15-21.08 as runtime version) mkdir app repo touch org.flatpak.myapp
here is the content of org.flatpak.myapp
{ "app-id": "org.flatpak.myApp", "runtime": "org.kde.Platform", "runtime-version": "5.15-21.08", "sdk": "org.kde.Sdk", "command": "myApp", "finish-args": [ "--share=ipc", "--socket=x11", "--socket=wayland", "--filesystem=host", "--device=dri" ], "modules": [ { "name": "myApp", "buildsystem": "cmake-ninja", "config-opts": ["-DCMAKE_BUILD_TYPE=RelWithDebInfo"], "sources": [ { "type": "dir", "path": "../" } ] } ] }
then I try to create the Flatpak using
flatpak-builder --user --ccache --repo=repo --subject="Build of MyApp software `date`" --force-clean app org.flatpak.myapp
But I get a basic error:
Emptying app dir 'app' Downloading sources Starting build of org.flatpak.myapp Cache miss, checking out last cache hit ======================================================================== Building module myapp in $HOME/myapp/flatpak/.flatpak-builder/build/myapp-1 ======================================================================== -- The CXX compiler identification is GNU 11.3.0 -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Check for working CXX compiler: /run/ccache/bin/c++ - skipped -- Detecting CXX compile features -- Detecting CXX compile features - done CMake Error at /usr/lib/x86_64-linux-gnu/cmake/Qt5/Qt5Config.cmake:28 (find_package): Could not find a package configuration file provided by "Qt5WebEngineWidgets" with any of the following names: Qt5WebEngineWidgetsConfig.cmake qt5webenginewidgets-config.cmake Add the installation prefix of "Qt5WebEngineWidgets" to CMAKE_PREFIX_PATH or set "Qt5WebEngineWidgets_DIR" to a directory containing one of the above files. If "Qt5WebEngineWidgets" provides a separate development package or SDK, be sure it has been installed. Call Stack (most recent call first): src/CMakeLists.txt:14 (find_package) -- Configuring incomplete, errors occurred! See also "/run/build/myapp/CMakeFiles/CMakeOutput.log". Error: module myapp: Le processus fils s’est terminé avec le code 1
Note that cmake has no problem to find Qt5WebEngineWidgets when I cmake/compile myapp in the classical way (withtout Flatpak).
Do you know how to solve that?
-
OK, it seems that QtWebEngine is not part of KDE Flatpak SDK. So, here is what I did
flatpak install --user flathub io.qt.qtwebengine.BaseApp//5.15-21.08
and I added two lines in the manifest org.flatpak.myapp ("base" and "base-version"):
{ "app-id": "org.flatpak.myapp", "runtime": "org.kde.Platform", "runtime-version": "5.15-21.08", "sdk": "org.kde.Sdk", "base": "io.qt.qtwebengine.BaseApp", "base-version": "5.15-21.08", "command": "myapp", "finish-args": [ "--share=ipc", "--socket=x11", "--socket=wayland", "--filesystem=host", "--device=dri" ], "modules": [ { "name": "myapp", "buildsystem": "cmake-ninja", "config-opts": ["-DCMAKE_BUILD_TYPE=RelWithDebInfo"], "sources": [ { "type": "dir", "path": "../" } ] } ] }