Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. Trying to create Linux installer for my Qt C++ Widget application

Trying to create Linux installer for my Qt C++ Widget application

Scheduled Pinned Locked Moved Unsolved Installation and Deployment
11 Posts 2 Posters 431 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Gilboonet
    28 Feb 2025, 19:12

    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 :
    Screenshot_20250228_182548.png

    • 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 ?

    J Offline
    J Offline
    JonB
    wrote on 28 Feb 2025, 20:01 last edited by JonB
    #2

    @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?`

    G 1 Reply Last reply 28 Feb 2025, 20:08
    0
    • J JonB
      28 Feb 2025, 20:01

      @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?`

      G Offline
      G Offline
      Gilboonet
      wrote on 28 Feb 2025, 20:08 last edited by
      #3

      @JonB No, it was a typo, you're right it's "network". I'm typing it as those messages are from the pc that I use to try the installer and I'm writing to the forum on my dev pc.

      1 Reply Last reply
      0
      • G Offline
        G Offline
        Gilboonet
        wrote on 1 Mar 2025, 15:45 last edited by
        #4

        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})
        
        1 Reply Last reply
        0
        • G Offline
          G Offline
          Gilboonet
          wrote on 1 Mar 2025, 17:24 last edited by Gilboonet 3 Jan 2025, 17:25
          #5

          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 package

          The 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 ?

          1 Reply Last reply
          0
          • G Offline
            G Offline
            Gilboonet
            wrote on 2 Mar 2025, 09:36 last edited by
            #6

            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 :
            Screenshot_20250302_103324.png

            First think I want to do is upgrade Qt version to 6.8.2 that I'm need to develop my application.

            1 Reply Last reply
            0
            • G Offline
              G Offline
              Gilboonet
              wrote on 3 Mar 2025, 08:46 last edited by
              #7

              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.

              1 Reply Last reply
              0
              • G Offline
                G Offline
                Gilboonet
                wrote on 3 Mar 2025, 10:40 last edited by
                #8

                It didn't take long to create a working windows deployment application using windeployQt and binarycreator from Qt Installer Framework. Let's hope it will be possible on a fresh Linux install on a pc (not a mac).

                1 Reply Last reply
                0
                • G Offline
                  G Offline
                  Gilboonet
                  wrote on 3 Mar 2025, 15:41 last edited by
                  #9

                  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.
                  Copie d'écran_20250303_153126.png

                  1 Reply Last reply
                  0
                  • G Offline
                    G Offline
                    Gilboonet
                    wrote on 5 Mar 2025, 21:56 last edited by
                    #10

                    Just found (here) this ...
                    Qt Packaging Recommendations

                    Distributions might want to package multiple different Qt versions. By taking the example of a Linux distribution, we recommend the following approach:

                    Configure Qt to install executables to /usr/qt6/bin.
                    Create symlinks with version suffixes in /usr/bin to user-facing applications that reside in /usr/qt6/bin. For example, create the symlink /usr/bin/designer6 that points to /usr/qt6/bin/designer.
                    

                    User-facing applications are Qt tools that are supposed to be started by the user. This includes qmake, Qt Widgets Designer, Qt Linguist, and others. Other tools, such as moc, rcc, and uic are usually not manually invoked by the user but from the build system of user projects.

                    In Qt's build system, tools that we consider as user-facing are marked as such, and that information can be extracted and used as follows.

                    Configure Qt with the CMake arguments:

                    -DCMAKE_INSTALL_PREFIX=/usr
                    -DINSTALL_BINDIR=/usr/qt6/bin
                    -DINSTALL_PUBLICBINDIR=/usr/bin
                    

                    This will create a file called user_facing_tool_links.txt in Qt's build directory. It contains on each line the path of a user-facing tool in INSTALL_BINDIR and, separated by one space, the path to the versioned link in INSTALL_PUBLICDIR.

                    This file can be used to create all versioned symlinks:

                    xargs ln -s < user_facing_tool_links.txt
                    
                    1 Reply Last reply
                    0
                    • G Offline
                      G Offline
                      Gilboonet
                      wrote on 6 Mar 2025, 21:09 last edited by Gilboonet 21 days from now
                      #11

                      I'm now trying to follow the Deployment | Build with CMake 6.8.2 doc (see here). It took me a long time to understand that it is not done with Qt Creator interactively but on a terminal command line. I changed my CMakeLists.txt to add the needed lines provided by the doc :

                      cmake_minimum_required(VERSION 3.22)
                      
                      project(Deplieur VERSION 0.1 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(QT NAMES Qt6 REQUIRED COMPONENTS Widgets LinguistTools)
                      find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Widgets LinguistTools)
                      find_package(Qt6 REQUIRED COMPONENTS Network)
                      
                      find_package(Qt6 REQUIRED COMPONENTS Core)
                      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 Qt${QT_VERSION_MAJOR}::Widgets)
                      target_link_libraries(Deplieur PRIVATE Qt6::Network)
                      
                      target_link_libraries(Deplieur PRIVATE Qt6::Core)
                      
                      #target_link_options(Deplieur PUBLIC -sASYNCIFY -Os)
                      
                      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}
                      )
                      
                      qt_finalize_executable(Deplieur)
                      
                      qt_generate_deploy_app_script(
                          TARGET Deplieur
                          OUTPUT_SCRIPT deploy_script
                          NO_UNSUPPORTED_PLATFORM_ERROR
                      )
                      install(SCRIPT ${deploy_script})
                      

                      But when I run (from my release directory)

                      ninja install
                      

                      or

                      cmake --install .
                      

                      there's an error, apparently a path to qt.conf is malformed, so I certainly did something wrong or didn't do something needed, but I don't see what. I must say that it is a process that I never used before, and if I was able to learn C++ for that project, I'm not sure that I can also teach myself all those system tools.

                      first time I ran ninja install

                      gilboonet@GigiMacBookPro:~/Documents/dev/C++/Deplieur/build/Desktop_Qt_6_8_2-Release$ ninja install
                      [0/2] Re-checking globbed directories...
                      -- GLOB mismatch!
                      -- GLOB mismatch!
                      [1/2] Re-running CMake...
                      -- Configuring done (0.4s)
                      -- Generating done (0.0s)
                      -- Build files have been written to: /home/gilboonet/Documents/dev/C++/Deplieur/build/Desktop_Qt_6_8_2-Release
                      [0/2] Re-checking globbed directories...
                      [0/1] Install the project...
                      -- Install configuration: "Release"
                      -- Up-to-date: /home/gilboonet/Documents/dev/C++/Deplieur/build/Desktop_Qt_6_8_2-Release/bin/Deplieur
                      -- Writing /usr/local//home/gilboonet/Documents/dev/C++/Deplieur/build/Desktop_Qt_6_8_2-Release/bin/qt.conf
                      CMake Error at /home/gilboonet/Qt/6.8.2/gcc_64/lib/cmake/Qt6Core/Qt6CoreDeploySupport.cmake:93 (file):
                        file failed to open for writing (No such file or directory):
                      
                          /usr/local//home/gilboonet/Documents/dev/C++/Deplieur/build/Desktop_Qt_6_8_2-Release/bin/qt.conf
                      Call Stack (most recent call first):
                        /home/gilboonet/Qt/6.8.2/gcc_64/lib/cmake/Qt6Core/Qt6CoreDeploySupport.cmake:405 (qt6_deploy_qt_conf)
                        .qt/deploy_Deplieur_8df5c22dfa.cmake:5 (qt6_deploy_runtime_dependencies)
                        cmake_install.cmake:74 (include)
                      
                      
                      FAILED: CMakeFiles/install.util 
                      
                      

                      second time I ran it

                      gilboonet@GigiMacBookPro:~/Documents/dev/C++/Deplieur/build/Desktop_Qt_6_8_2-Release$ ninja install
                      [0/2] Re-checking globbed directories...
                      -- GLOB mismatch!
                      -- GLOB mismatch!
                      [1/2] Re-running CMake...
                      -- Configuring done (0.4s)
                      -- Generating done (0.0s)
                      -- Build files have been written to: /home/gilboonet/Documents/dev/C++/Deplieur/build/Desktop_Qt_6_8_2-Release
                      [0/2] Re-checking globbed directories...
                      [0/1] Install the project...
                      -- Install configuration: "Release"
                      -- Up-to-date: /home/gilboonet/Documents/dev/C++/Deplieur/build/Desktop_Qt_6_8_2-Release/bin/Deplieur
                      -- Writing /usr/local//home/gilboonet/Documents/dev/C++/Deplieur/build/Desktop_Qt_6_8_2-Release/bin/qt.conf
                      CMake Error at /home/gilboonet/Qt/6.8.2/gcc_64/lib/cmake/Qt6Core/Qt6CoreDeploySupport.cmake:93 (file):
                        file failed to open for writing (No such file or directory):
                      
                          /usr/local//home/gilboonet/Documents/dev/C++/Deplieur/build/Desktop_Qt_6_8_2-Release/bin/qt.conf
                      Call Stack (most recent call first):
                        /home/gilboonet/Qt/6.8.2/gcc_64/lib/cmake/Qt6Core/Qt6CoreDeploySupport.cmake:405 (qt6_deploy_qt_conf)
                        .qt/deploy_Deplieur_8df5c22dfa.cmake:5 (qt6_deploy_runtime_dependencies)
                        cmake_install.cmake:74 (include)
                      
                      
                      FAILED: CMakeFiles/install.util 
                      
                      
                      1 Reply Last reply
                      0

                      11/11

                      6 Mar 2025, 21:09

                      • Login

                      • Login or register to search.
                      11 out of 11
                      • First post
                        11/11
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • Users
                      • Groups
                      • Search
                      • Get Qt Extensions
                      • Unsolved