Trying to create Linux installer for my Qt C++ Widget application
-
@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.
-
Just found (here) this ...
Qt Packaging RecommendationsDistributions 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
-
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