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. Creating an installer for Linux
Forum Updated to NodeBB v4.3 + New Features

Creating an installer for Linux

Scheduled Pinned Locked Moved Unsolved Installation and Deployment
7 Posts 6 Posters 2.1k Views 3 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.
  • C Offline
    C Offline
    ChainReaction
    wrote on last edited by
    #1

    I have written a QT application and I want to ship it to users in the company.
    The application is managed in GitLab.

    I now want folks to be able to easily download and install it (Each user might has their own Linux flavor but they are all Linux).

    How do I create an installer?
    I looked around and found that using GNU autotools you could allow users to simply do:

    ./configure
    make && make install
    

    but I couldn't figure out how this supposed to work with qt and my *.pro file...

    Is there a guide on how to ship software?

    1 Reply Last reply
    0
    • TomZT Offline
      TomZT Offline
      TomZ
      wrote on last edited by
      #2

      Simplest way (big initial cost, low cost of maintenance) is to compile your own Qt statically, then link your app to that and put up the binary on your place people can download it on your company's intranet.

      There isn't really one thing that will work for all distro's. But you could naturally just look at the many other Qt based apps on places like gitlab which have compile guides. This tends to not be useful as you might not want to force your users to install a compiler and the headers (especially ubuntu is a nightmare when it comes to the amount of packages needed).

      JoeCFDJ 1 Reply Last reply
      0
      • TomZT TomZ

        Simplest way (big initial cost, low cost of maintenance) is to compile your own Qt statically, then link your app to that and put up the binary on your place people can download it on your company's intranet.

        There isn't really one thing that will work for all distro's. But you could naturally just look at the many other Qt based apps on places like gitlab which have compile guides. This tends to not be useful as you might not want to force your users to install a compiler and the headers (especially ubuntu is a nightmare when it comes to the amount of packages needed).

        JoeCFDJ Offline
        JoeCFDJ Offline
        JoeCFD
        wrote on last edited by
        #3

        @TomZ Be aware that Qt is not free for static link.

        1 Reply Last reply
        0
        • JoeCFDJ Offline
          JoeCFDJ Offline
          JoeCFD
          wrote on last edited by JoeCFD
          #4

          on Ubuntu, you create a deb file which includes all your code and qt stuff needed. Simply install the deb file on Ubuntu of your client. Use cpack of cmake to do it on Linux. In different Linux distributions, you have to pack your code differently. You may also need to pack your code for different versions of Linux. It can be messy.

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

            Hi,

            Depending on your end goal (distro aware package or something more generic), you might want to check the linuxdeployqt project.

            Static builds have their constraints with regards to both GPL and LGPL which makes them really impractical thus shared build should be prefered.

            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
              SimonSchroeder
              wrote on last edited by
              #6

              We use a mix of linuxdeploy and linuxdeployqt. Both have their strength and weaknesses. Together these will create an AppImage that can be used on most Linux distributions. It is key that you use an old Linux install with old libraries to support old as well as new Linux distros. We use a CentOS 7 installation to compile. This works on Ubuntu 18 and 20, CentOS/RedHat and OpenSuse/SuSE (not all platforms are well tested). We still have another version compiled on Ubuntu 16, but that does not work anymore on Ubuntu 20. The deploy tools will require to use an older distro or just refuse to work.

              Here is the script that we use to create the AppImage:

              #!/bin/bash
              
              LD_LIBRARY_PATH=../../hdf5-1.10.4/linux64 # additional library paths which are not system-wide
              export LD_LIBRARY_PATH
              
              chmod u+x linuxdeploy*.AppImage
              export VERSION=1.2.3
              
              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-6-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. ==
              

              Having a MyApp.desktop and a MyApp.svg are optional, but help with integration into the start menu.

              In addition, we are using the Qt Installer Framework to generate an installer. This will install several files besides the AppImage. Also, it uses xdg-mime install to register file extensions and xdg-mime default to link the file extension with our app. This ensures that you can use xdg-open on known file types on the console and double click on files in file browsers.

              The AppImage will have almost all of the necessary runtime libraries (also Qt), even some C/C++ dynamic libraries. There are very few cases where this will still have problems with incompatible dynamic libraries.

              PS: There are other approaches besides AppImage, like Flatpak and Snap, which work quite similar. AppImage is the one we picked.

              1 Reply Last reply
              0
              • I Offline
                I Offline
                iieklund
                wrote on last edited by
                #7

                Hi!

                Like @SimonSchroeder already replied, one option is also to create an Offline installer using Qt Installer Framework. As the payload, you can put the binaries you've built. You can also customize the menu's in the installer and customize the installation procedure using scripting interface.

                E.g. this offline installer is created using the Qt Installer Framework: https://download.qt.io/official_releases/qtcreator/8.0/8.0.2/qt-creator-opensource-linux-x86_64-8.0.2.run

                https://doc.qt.io/qtinstallerframework/

                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