Trying to create Linux installer for my Qt C++ Widget application
-
Hello, I'm currently trying to create the first release of my Application for desktop, and as I'm using Linux on my dev machine, I'm starting with Linux then I'll make Windows installation. I'm using Qt Installation tool and here is what I'm doing :
- I compiled my application for Desktop on release
- I created a folder with needed structure and put my executable on its package/data sub-folder
- I also added Qt libraries to it
- and I created a "platform" folder on it where I put 'libqxcb.so' (I'm not sure of that part)
Then I run "binarycreator" and it creates the installer executable.
To test the installer, I put it as release on Github page of the application, then I download it with another linux machine that doesn't have Qt installed. For the moment it keeps complaining that some libraries are not found :
/home/gilboo/Deplieur3d/Deplieur: error while loading shared libraries: libicuuc.so.73: cannot open shared object file: No such file or directory
I ran 'ldd' command on the application executable and it listed 80 libraries, Qt ones that I already shipped. I tried to make an installation with all those 80 libraries, that made a 66 Mb file, but it didn't work. So, I try to progress step by step but I'm not sure I'm doing it right.
When I run the installer, there's an error that makes me think that I'm not doing what needs to be done with libqxcb.so :
qt.qpa.plugin: Could not find the Qt platform plugin "wayland" in "" qt.dbus.integration : Could not connect "org.freedesktop.NetworkManager" to "stateChanged" qt.dbus.integration : Could not connect "org.freedesktop.NetworkManager" to "connectivityChanged" qt.dbus.integration : Could not connect "org.freedesktop.NetworkManager" to "deviceTypeChanged" qt.dbus.integration : Could not connect "org.freedesktop.NetworkManager" to "meteredChanged"
And when I run the installed executable, there is also an error about the qpa plugin :
qt.qpa.plugin: Could not find the Qt platform plugin "wayland" in "" (same as the installer) qt.qpa.plugin: From 6.5.0, xcb-cursor0 or libxcb-cursor0 is needed to load the Qt xcb platform plugin. qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "" even though it was found. This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem. Available platform plugins are: xcb.
Apparently the "Qt for Linux/X11 - Deployment" documentation that I'm trying to use doesn't give enough information. Maybe should I use non Qt tools like LinuxDeployQt or the more recent LinuxDeploy instead of trying to grab libraries by myself ?
-
@Gilboonet said in Trying to create Linux installer for my Qt C++ Widget application:
qt.dbus.integration : Could not connect "org.freedesktop.NewworkManager" to "stateChanged"
Is this a copy & paste of the output you get? Because that should surely be
NetworkManager
, so what is going on?` -
I'm now trying to make my deployment using CMake, as described here. Apparently it creates a script that must be called by the command "cmake --install" but I don't see how to do that. I mean, that from Qt there's only the option to run CMake of the project on the compile menu (execute CMake). And it I use the CLI, I will need to install CMake.
Here's my CMakeLists.txt, maybe did I forget to add something to it or did it wrong ?
cmake_minimum_required(VERSION 3.22) project(Deplieur VERSION 0.2 LANGUAGES CXX) set(CMAKE_AUTOUIC ON) set(CMAKE_AUTOMOC ON) set(CMAKE_AUTORCC ON) set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED ON) find_package(Qt6 REQUIRED COMPONENTS Core) find_package(Qt6 REQUIRED COMPONENTS Widgets) find_package(Qt6 REQUIRED COMPONENTS LinguistTools) find_package(Qt6 REQUIRED COMPONENTS Network) qt_standard_project_setup() set(TS_FILES Deplieur_fr_FR.ts) set(PROJECT_SOURCES main.cpp mainwindow.cpp ${TS_FILES} ) qt_add_executable(Deplieur MANUAL_FINALIZATION ${PROJECT_SOURCES} mainwindow.h resources.qrc depliage.h depliage.cpp mat4x4.h mat4x4.cpp vec3d.h vec3d.cpp triangle2d.h triangle2d.cpp depliagescene.h depliagescene.cpp depliagevue3d.h depliagevue3d.cpp triangleitem2d.h triangleitem2d.cpp triangleitem3d.h triangleitem3d.cpp facette.h facette.cpp depliagevue2d.h depliagevue2d.cpp piecepolygonitem.h piecepolygonitem.cpp pieceligneitem.h pieceligneitem.cpp piecelangitem.h piecelangitem.cpp piecenumitem.h piecenumitem.cpp filedownloader.h filedownloader.cpp ) qt_create_translation(QM_FILES ${CMAKE_SOURCE_DIR} ${TS_FILES}) target_link_libraries(Deplieur PRIVATE Qt6::Core) target_link_libraries(Deplieur PRIVATE Qt6::Widgets) target_link_libraries(Deplieur PRIVATE Qt6::Network) #target_link_options(Deplieur PUBLIC -sASYNCIFY -Os) # Qt for iOS sets MACOSX_BUNDLE_GUI_IDENTIFIER automatically since Qt 6.1. # If you are developing for iOS or macOS you should consider setting an # explicit, fixed bundle identifier manually though. #if(${QT_VERSION} VERSION_LESS 6.1.0) # set(BUNDLE_ID_OPTION MACOSX_BUNDLE_GUI_IDENTIFIER com.example.Deplieur) #endif() set_target_properties(Deplieur PROPERTIES ${BUNDLE_ID_OPTION} MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION} MACOSX_BUNDLE_SHORT_VERSION_STRING ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR} MACOSX_BUNDLE TRUE WIN32_EXECUTABLE TRUE ) include(GNUInstallDirs) install(TARGETS Deplieur BUNDLE DESTINATION . LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} ) if(QT_VERSION_MAJOR EQUAL 6) qt_finalize_executable(Deplieur) endif() # Generate the deployment script for the target Deplieur qt_generate_deploy_app_script( TARGET Deplieur OUTPUT_SCRIPT deploy_script NO_UNSUPPORTED_PLATFORM_ERROR ) # Call the deployment script on "cmake --install". install(SCRIPT ${deploy_script})
-
Another way to deploy my application on Linux could be by building a binary debian package, and I'm trying to do that. At the end of the process, there's a command to run to get all the dependencies, and here is what it told me :
gilboonet@GigiMacBookPro:~/Documents/dev/DEBS/deplieur3d_0.2_amd64$ dpkg-shlibdeps -O /home/gilboonet/Documents/dev/DEBS/deplieur3d_0.2_amd64/usr/local/bin/Deplieur dpkg-shlibdeps: erreur: pas d'information de dépendance trouvée pour /home/gilboonet/Qt/6.8.2/gcc_64/lib/libQt6Widgets.so.6 (utilisé par /home/gilboonet/Documents/dev/DEBS/deplieur3d_0.2_amd64/usr/local/bin/Deplieur) Indication: vérifiez que la bibliothèque provienne bien d'un paquet.
dpkg-shlibreps (the command) : error : no dependency data found for ...
hint : ensure that the library comes from a packageThe library, libQt6Widgets.so.6 is linked to libQt6Widgets.so.6.8.2 that comes from my Qt installation that I updated unsing the maintenance tool. What can I do to make this dpkg command correctly analyze that dependency ? Install the Qt libraries using sudo apt-get install qt6.8.2-full-deb ? Or would it break my Qt install ?
-
Well, as I had the same result by using LinuxDeploy (qt.qpa.plugin : Could not find the Qt platform plugin ... ), especially that its Qt plugin didn't detect that my binary uses Qt modules (even if it added all libQt6 .so libraries to its AppDir), I suspect that there's something crucial that I didn't do. So I'm about to reinstall Qt. I uninstalled it, then reboot. Here's my dev machine specs :
First think I want to do is upgrade Qt version to 6.8.2 that I'm need to develop my application.
-
I didn't manage to update my system Qt version even if I reinstalled Qt Creator and am able to compile my application again, but still no progress about deployment. For now I won't dig this and will give a try at Windows deployment, then I will get back to Linux but not from this old MacBookPro as it doesn't want to boot to KUbuntu 24.04/24.10 nor KDE Neon, both shipped with Qt6.
-
I installed Fedora Linux 41 with KDE, and it is shipped with Qt 6.7. From there I'm going to install Qt Creator, compile my application then try to create a deployment executable. I'm open for all tips, especially if you already did such thing with success.