Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QtWebEngine
  4. Unable to include dependent .so libraries when generating .deb package for Qt application

Unable to include dependent .so libraries when generating .deb package for Qt application

Scheduled Pinned Locked Moved Unsolved QtWebEngine
4 Posts 3 Posters 635 Views 1 Watching
  • 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.
  • S Offline
    S Offline
    smit.patel
    wrote on last edited by
    #1

    I’m building a Qt C++ application for Linux (Ubuntu), and I want to distribute it as a .deb package.
    However, I’m unable to include the required .so dependency files (for example libQt6WebEngineCore.so, libQt6WebView.so, etc.) inside the generated .deb installer.

    When I install the .deb on another system (without Qt installed), the app fails to start due to missing shared libraries.
    I wanted to know, How to add required dependency to .deb file ?

    Environment:

    Qt Version: 6.10.0
    OS: Ubuntu 22.04.5
    Build Tool: CMake

    jsulmJ 1 Reply Last reply
    0
    • S smit.patel

      I’m building a Qt C++ application for Linux (Ubuntu), and I want to distribute it as a .deb package.
      However, I’m unable to include the required .so dependency files (for example libQt6WebEngineCore.so, libQt6WebView.so, etc.) inside the generated .deb installer.

      When I install the .deb on another system (without Qt installed), the app fails to start due to missing shared libraries.
      I wanted to know, How to add required dependency to .deb file ?

      Environment:

      Qt Version: 6.10.0
      OS: Ubuntu 22.04.5
      Build Tool: CMake

      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @smit.patel said in Unable to include dependent .so libraries when generating .deb package for Qt application:

      due to missing shared libraries

      Which libraries exactly are missing? Were those libs installed by your deb package and if so where exactly?

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • SGaistS Offline
        SGaistS Offline
        SGaist
        Lifetime Qt Champion
        wrote on last edited by
        #3

        Hi and welcome to devnet,

        Why not declare that your package depends on Qt 6 ?
        That will trigger proper installation of Qt on the target system.

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        1 Reply Last reply
        0
        • S Offline
          S Offline
          smit.patel
          wrote on last edited by
          #4
          cmake_minimum_required(VERSION 4.0)
          project(desk_pos_test)
          
          set(CMAKE_CXX_STANDARD 20)
          set(CMAKE_AUTOMOC ON)
          set(CMAKE_AUTORCC ON)
          set(CMAKE_AUTOUIC ON)
          
          
          # Tell the binary to look for libraries inside ../lib relative to executable
          set(CMAKE_BUILD_RPATH "$ORIGIN/../lib")
          set(CMAKE_INSTALL_RPATH "$ORIGIN/../lib")
          
          
          find_package(Qt6 COMPONENTS
                  Core
                  Gui
                  Widgets
                  WebEngineWidgets
                  WebEngineCore
                  REQUIRED)
          
          
          qt6_wrap_cpp(MOC_SOURCES main.cpp)
          add_executable(desk_pos_test main.cpp
                  main.cpp
          )
          target_link_libraries(desk_pos_test
                  Qt::Core
                  Qt::Gui
                  Qt::Widgets
                  Qt::WebEngineWidgets
                  Qt::WebEngineCore
          )
          
          install(TARGETS desk_pos_test
                  RUNTIME DESTINATION bin
          )
          
          ## ✅ Install Qt libraries (if you ship them)
          #install(DIRECTORY ${CMAKE_SOURCE_DIR}/packages/com.medkart.desktopPos/data/lib/
          #        DESTINATION lib/desk-pos-app
          #)
          
          function(copy_qt_lib libname)
              get_target_property(_qt_lib_location Qt6::${libname} LOCATION)
              install(FILES ${_qt_lib_location}
                      DESTINATION lib/desk-pos-app
              )
          endfunction()
          
          # Copy only the required modules
          copy_qt_lib(Core)
          copy_qt_lib(Gui)
          copy_qt_lib(Widgets)
          copy_qt_lib(WebEngineCore)
          copy_qt_lib(WebEngineWidgets)
          copy_qt_lib(WebChannel)
          
          # ✅ Install resources to /usr/local/share/desk-pos-app
          install(DIRECTORY ${CMAKE_SOURCE_DIR}/packages/com.medkart.desktopPos/data/
                  DESTINATION share/desk-pos-app
                  FILES_MATCHING PATTERN "*"
                  EXCLUDE PATTERN "lib/*"
          )
          
          install(FILES ${CMAKE_SOURCE_DIR}/resources/desk-pos-app.desktop
                  DESTINATION /usr/share/applications)
          
          install(FILES ${CMAKE_SOURCE_DIR}/resources/desk-pos-app.svg
                  DESTINATION /usr/share/pixmaps)
          

          I am packaging my Qt6 application as a .deb using the CMake setup shown above, which installs the executable, resources, and Qt libraries. and run the following command to make the .deb file, from project folder in terminal

          rm -rf build
          mkdir build && cd build
          cmake .. -DCMAKE_BUILD_TYPE=Release
          cpack -G DEB
          

          Is this an appropriate method for distributing a Qt application to other Linux systems?
          How can I optimize this CMake configuration for more reliable deployment and easier updates?

          1 Reply Last reply
          0

          • Login

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