Important: Please read the Qt Code of Conduct -

Recommended way to deploy/install Qt6 shared libraries

  • Hi guys, I have a development machine with Ubuntu 20.04 x64 and a target machine with Ubuntu Server (no GUI) 20.04 x64.
    Which is the best way to install or deploy the shared libraries to the target machine?
    Of course there are several options:

    • build from source on the target itself
    • copy the libraries from ~/Qt/6.2.0/gcc_64/lib/

    But I wonder if there's a tool to make this process reliable and easier. For example, like the online installer but with no GUI (I didn't find a command line version for it). Or even just a tar.gz containing the shared libraries compiled for the most common architectures (x86/x64/arm, ecc...).

    Or even a function inside QtCreator to deploy the required libraries during the deployment steps (of course without manually selecting one by one...).

  • Lifetime Qt Champion

    @Mark81 said in Recommended way to deploy/install Qt6 shared libraries:

    But I wonder if there's a tool to make this process reliable and easier

    There is an unofficial tool:

  • @jsulm Unfortunately it does not work with Ubuntu 20.04 (just tried):

  • Lifetime Qt Champion

    @Mark81 There is a flag you can pass when calling the tool to overrule the "too new glibc" error.

  • @jsulm I'm going to search for that flag. But, correct me if I'm wrong, this would just copy the required files, right? I mean, it does not take care of installing egl support or other libraries I may need on the target I guess.

  • @jsulm I tried that recently in a feat to deploy one of my tools for my coworkers using linux - that flag doesn't do much good, the tool doesn't work correctly with that setting. That is also mentioned by the author somewhere in the linked thread...
    I tried various other things but ended up installing Qt 5.12.8 that is provided by Ubuntu and wrapping up dependencies to be pulled by apt as native packages.
    Might be that I tried something wrong but I used ldd and friends to sort out dependencies - the first level ones were easy to find but then there come plugins and their dependencies that also need to be provided (some of them are not binary compatible with the ones provided by Ubuntu which I discovered the hard way) and it's just too much work I think.

  • Lifetime Qt Champion

    @Mark81 said in Recommended way to deploy/install Qt6 shared libraries:

    this would just copy the required files, right?

    The thing with Linux is that there are many different distributions, in different versions with different package managers. So, there is no "one fits all" solution for Linux. For example: for Debian based Distributions you would create a Debian (deb) package where you also define the dependencies and where to install what. For RedHat/Fedora based distributions you would create a RPM package.
    Since you want to support Ubuntu 20.04 you should take a look at how to create Debian packages.

  • @jsulm I understand that, but why there is no way to invoke the Qt Installer from command line? I works perfectly on a Desktop environment... so it can also download and build the selected modules in a server environment.

    Building from sources requires several GB of spaces, tons of packages, lot of hours and headaches for something that the installer does every time with no pain...

  • Lifetime Qt Champion

    @Mark81 Why do you need to build anything on the target machine?
    Why not build your app on the developer machine, create installer or Debian package and distribute it then?

  • @jsulm Because as I said the target machine does not run the X server. So when developing I need to debug the remote application while it runs with eglfs. Furthermore in this project the screen is vertical, so it would be very tricky to develop locally...

    Another example: for another project (always with Ubuntu Server 20.04) the target machine is connected to the field (Modbus, OPC-UA and Ethernet). I can't really debug the console application locally, I have to run and debug it on the target otherwise I cannot receive the data from the field.

  • Lifetime Qt Champion

    @Mark81 You don't have to build on target machine to do remote debugging. Build on your developer machine, copy the binary to the target machine and debug remotely.

  • @jsulm the problem is it does not deploy the libraries! And without the libraries of course it cannot run.
    I meant build the Qt6 libraries, not my application.

  • Lifetime Qt Champion

    @Mark81 Simply deploy the libraries once from host to the target...

  • @jsulm I wrote this suggestion in my own question :-)
    But it does work for console application only.

    I guess it is because the libraries on the dev machines are built (from the online installed) against x11, while the target machine requires eglfs. I tried to explore the online installer items but I didn't find anything that allows me to select eglfs. I guess it detects the platform automatically when it runs. From here the request to run it without X.

  • Lifetime Qt Champion

    @Mark81 said in Recommended way to deploy/install Qt6 shared libraries:

    But it does work for console application only.

    It should work if you also deploy eglfs platform plug-in.

  • @jsulm so far I tried to build a simple QtWidget "Hello world" application on my dev machine.
    Then I copied it to the target with this structure:

    $ tree
    ├── test_qt6
    │   └── bin
    │   ├── test_qt6
    │   └── platforms
    │   └──
    ├── qt6_libs
    │ ├──
    │ ├──
    │ ├──
    │ ├──
    │ ├──
    │ ├──

    but running the application with:

    LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/user/qt6_libs /home/user/test_qt6/bin/./test_qt6 -platform eglfs

    it still searches for x11:

    ./test_qt6: error while loading shared libraries: cannot open shared object file: No such file or directory

    ps. sorry but the editor loses the indentation. The platform plugin file is actually inside the platforms directory


    I tried to copy the missing library, now ldd finds all.
    But still does not run:

    EGLFS: Failed to open /dev/fb0
    EGLFS: Can't continue without a display

    I'm working to check the permissions.... fixed.

    $ export QT_QPA_PLATFORM=eglfs
    $ export QT_QPA_EGLFS_FB=/dev/fb0
    $ LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/user/qt6_libs ./test_qt6 -platform eglfs
    Could not initialize egl display
    Aborted (core dumped)

Log in to reply