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. Qt5.3.1 app deployment on Linux troubles

Qt5.3.1 app deployment on Linux troubles

Scheduled Pinned Locked Moved Installation and Deployment
6 Posts 3 Posters 2.5k 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.
  • M Offline
    M Offline
    march
    wrote on last edited by
    #1

    Hello everyone. I have some troubles when I deploy my app into Linux-platform. Unless specifically the problem lies in the platforms and sqldivers plugins.
    There'r the steps what I did:
    I compiled my app in Linux-platform and it's run perfect via QtCreator.
    Next I temporary renamed some folder in path to Qt environment to disable this environment.
    Next I created a folder e.g. /home/user/bin and replaced my app file, my libs, needed Qt -libs.
    Then I added in .bashrc file LD_LIBRARY_PATH variable:
    .bashrc:
    ...
    LD_LIBRARY_PATH=/home/usr/bin
    export LD_LIBRARY_PATH

    Next I run ldd ./myapp to check libraries needed. All libs present.
    Then I copied platforms and sqldrivers folders to my app folder.
    Finally my distribution looks like:
    platforms
    sqldrivers
    myapp
    libme.so.1
    libQt5Core.so.5
    libQt5Gui.so.5
    ...

    platforms folder:
    libqxcb.so
    libqoffscreen.so
    libqminimal.so
    libqlinuxfb.so

    sqldrivers folder:
    libqsqlmysql.so
    libqsqlite.so

    And when I do ./myapp in bash I see:
    QSqlDatabase: QMYSQL driver not loaded
    QSqlDatabase: available drivers:
    QSqlDatabase: an instance of QCoreApplication is required for loading driver plugins
    This application failed to start because it could not find or load the Qt platform plugin "xcb"

    Then I added QT_QPA_PLATFORM_PLUGIN_PATH=/home/user/bin/platforms. Error messages were changed:
    QSqlDatabase: QMYSQL driver not loaded
    QSqlDatabase: available drivers:
    QSqlDatabase: an instance of QCoreApplication is required for loading driver plugins
    QFontDatabase: Cannot find font directory /home/usr/Qt/qtbase/lib/fonts - is Qt installed correctly?

    At the moment I do not know what to do.

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

      Hi,

      All plugins (except platforms but you already did it right) should go in the plugins subfolder.

      Then you should be good to go

      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
      • L Offline
        L Offline
        liuqin2013
        wrote on last edited by
        #3

        I have the same troubles ,and when I set the environment variables:LD_LIBRARY_PATH and QT_QPA_PLATFORM_PLUGIN_PATH,then running the app like this:./imagegesture –plugin EvdevTouch ,the error is still exists:
        This application failed to start because it could not find or load the Qt platform plugin "xcb".
        Reinstalling the application may fix this problem.

        add the QT_DEBUG_PLUGINS=1 ,i see the error exists because of the libxcb.so'version is incompatibale .

        but i have not seen why the parameter "-plugin EdevTouch" has not work but it works in the development enviroment.

        My OS is Fedora20 and Qt is 5.3.1
        thanks!

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

          You don't have the same problem. Your target OS doesn't provide a suitable libxcb version.

          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
          • M Offline
            M Offline
            march
            wrote on last edited by
            #5

            Thanks to all for help.I found the solution.

            1. We must make visible our libQt5*.so libs and our own libs for runtime. There is 2 ways to do (As I founded):
            • use LD_LIBRARY_PATH env variable;
            • use chrpath utility (this I used).
              I downloaded chrpath utility and change RPATH variable in myapp file.
              $ chrpath -r . myapp
              This allows runtime to check libraries in same directory when our app located (this Windows-like behavior)
              Note. using chrpath -l myapp before changing we can see current RPATH value.
            1. Copy standart Qt plugins (platforms, sqldrivers etc) to defined directories.
            • in my case it was /usr/lib/kde4/plugins (I defined it using "$ export QT_DEBUG_PLUGINS=1" before running my app). It works but we need root permissions.
              I did another way.
              I add code to myapp main()-functions and recompile there (and rewrite RPATH var again)
              @int main(int argc, char** argv)
              {
              QStringList paths = QCoreApplication::libraryPaths();
              paths.append(".");
              paths.append("imageformats");
              paths.append("platforms");
              paths.append("sqldrivers");
              paths.append("fonts");
              QCoreApplication::setLibraryPaths(paths);

              QApplication a(argc, argv);
              ...
              }
              @
              That means that plugins loader see this subfolders in myapp folder and can find plugins standart libraries in this folders.

            1. Solution for QFontDatabase error -
              3.1) Copy fonts folder from ../qt/lib to .../myappfolder
              3.2) Define a QT_QPA_FONTDIR var -
              in my case
              $ export QT_QPA_FONTDIR=/home/usr/myappfolder/fonts
              $ ./myapp
              Thats it.
              We can do a shell script like this:
              @#!/bin/sh
              appname=basename $0 | sed s,\.sh$,,

            dirname=dirname $0
            tmp="${dirname#?}"

            if [ "${dirname%$tmp}" != "/" ]; then
            dirname=$PWD/$dirname
            fi

            #LD_LIBRARY_PATH=$dirname
            #export LD_LIBRARY_PATH

            export QT_QPA_FONTDIR=$dirname/fonts

            $dirname/$appname "$@"@

            Finally myappfolder looks like:
            @

            • fonts folder
            • platforms folder
            • imageformats folder (also copied from qt-folder/plugins)
            • sqldrivers folder
            • myapp.sh
            • myapp
            • libmyown.so.1
            • libQt5*.so.5
            • ...
              @
            1 Reply Last reply
            0
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #6

              You should Never (™) copy libraries like that, you might end up overwriting your system's own copy of Qt.

              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

              • Login

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