What is the best way to deploy my application in linux?
-
Hello everyone,
I want to deploy my app in ubuntu. How do you deploy your apps in linux, which way do you choose? Thanks in advance. -
Hello everyone,
I want to deploy my app in ubuntu. How do you deploy your apps in linux, which way do you choose? Thanks in advance. -
@dearqt is your qt version for deployment the same as the one installed in Ubuntu? If not, it can not be messy.
-
@JoeCFD How can I learn this? Which version should I use for ubuntu 22.04? So you are saying that I cannot deploy qt 5.12.12 version in ubuntu 22.04, did I get right?
@dearqt I did not mean that. Of course, you can. The default Qt version on Ubuntu 22.04 is 5.15.3. If your Qt version for development is the same, you can simply deploy your app and ask the user to install Qt 5.15.3 by themselves(provide a script for users to do it easily).
If 5.12.12 is applied, you have to install it with your app. The better location is /opt/Qt.
And you may want to use running time path in cmake or qmake file for all Qt libs to point to /opt/Qt/***/lib. -
@dearqt I did not mean that. Of course, you can. The default Qt version on Ubuntu 22.04 is 5.15.3. If your Qt version for development is the same, you can simply deploy your app and ask the user to install Qt 5.15.3 by themselves(provide a script for users to do it easily).
If 5.12.12 is applied, you have to install it with your app. The better location is /opt/Qt.
And you may want to use running time path in cmake or qmake file for all Qt libs to point to /opt/Qt/***/lib.@JoeCFD Thank you for your answer , do you know any tutorial or guide that I can follow to deploy my app? and I did not get the part you said, ask the user to install Qt. SO even though I deploy my app and created and executable, should the user install qt?
-
@JoeCFD Thank you for your answer , do you know any tutorial or guide that I can follow to deploy my app? and I did not get the part you said, ask the user to install Qt. SO even though I deploy my app and created and executable, should the user install qt?
-
@dearqt Check JonB's reply. The code is here:
https://github.com/probonopd/linuxdeployqtI use cpack of cmake to generate deb file to deploy my app and libs.
-
See also the official CMake deployment API for Qt (it is currently a Technical Preview, which means it's not complete yet): https://www.qt.io/blog/cmake-deployment-api
-
Flatpack was already mentioned as one example. We use AppImage instead. linuxdeployqt did not include everything as expected. Hence, we use both linuxdeploy and linuxdeployqt. Here is the main part of our script:
#!/bin/bash export VERSION=1.0.0 echo == Remove old AppDir. == rm -rf AppDir echo == Generate new AppDir. == ./linuxdeploy-x86_64.AppImage --appdir=AppDir --executable=../release/MyApp --desktop-file=MyApp.desktop --icon-file=MyApp.svg echo == Bundle Qt libs and create AppImage. == cd AppDir ../linuxdeployqt-v8-x86_64.AppImage MyApp.desktop -qmake=/opt/Qt/5.13.2/gcc_64/bin/qmake -appimage echo == Finish up... == mv MyApp-*-x86_64.AppImage ../MyApp-x86_64.AppImage echo == Done. ==
This works well across many Linux distributions. One disadvantage is that an AppImage includes all necessary Qt libraries instead of using those installed on the system. Therefore AppImages can become quite large. But they avoid most incompatibilities of different versions of dynamic libraries.