Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Unable to deploy Qt app under Linux
Forum Updated to NodeBB v4.3 + New Features

Unable to deploy Qt app under Linux

Scheduled Pinned Locked Moved Solved General and Desktop
43 Posts 3 Posters 14.6k 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.
  • A ambershark

    QMAKE_POST_LINK = strip <your binary> should do it.

    I may be wrong on the syntax, I long ago switched to cmake for building.

    M Offline
    M Offline
    mbnoimi
    wrote on last edited by
    #5

    @ambershark Thanks it works.

    QMAKE_POST_LINK = strip $${PWD}/$${DESTDIR}/$${TARGET}
    

    But unfortunately it didn't fix binary-or-shlib-defines-rpath

    kshegunovK 1 Reply Last reply
    0
    • M Offline
      M Offline
      mbnoimi
      wrote on last edited by
      #6

      binary-or-shlib-defines-rpath affects directly on the distro because it calls the stored paths

      1 Reply Last reply
      0
      • M mbnoimi

        @ambershark Thanks it works.

        QMAKE_POST_LINK = strip $${PWD}/$${DESTDIR}/$${TARGET}
        

        But unfortunately it didn't fix binary-or-shlib-defines-rpath

        kshegunovK Offline
        kshegunovK Offline
        kshegunov
        Moderators
        wrote on last edited by
        #7

        @mbnoimi
        Try setting the rpath qmake variable to point to nowhere (i.e. make it empty):

        QMAKE_RPATHDIR = 
        QMAKE_RPATHLINKDIR = # Possibly not needed
        

        Read and abide by the Qt Code of Conduct

        M 1 Reply Last reply
        0
        • kshegunovK kshegunov

          @mbnoimi
          Try setting the rpath qmake variable to point to nowhere (i.e. make it empty):

          QMAKE_RPATHDIR = 
          QMAKE_RPATHLINKDIR = # Possibly not needed
          
          M Offline
          M Offline
          mbnoimi
          wrote on last edited by
          #8

          @kshegunov said in Unstripped binary or object!:

          QMAKE_RPATHDIR =
          QMAKE_RPATHLINKDIR = # Possibly not needed

          Still get same error message:

          E: sync-accounts-manager: binary-or-shlib-defines-rpath opt/sync-accounts-manager/SyncAccountsManager /home/mbnoimi/.Qt/5.7/gcc_64/lib
          
          1 Reply Last reply
          0
          • M Offline
            M Offline
            mbnoimi
            wrote on last edited by
            #9

            I pushed my init project to github so because of this error I'm unable to connect to database:

            mbnoimivm@ubuntu:~$ /opt/sync-accounts-manager/SyncAccountsManager.sh
            QSqlDatabase: QMYSQL driver not loaded
            QSqlDatabase: available drivers: QSQLITE QMYSQL QMYSQL3 QPSQL QPSQL7
            Unable to connect!
            ^C
            mbnoimivm@ubuntu:~$ ldd /opt/sync-accounts-manager/SyncAccountsManager
            /opt/sync-accounts-manager/SyncAccountsManager: /usr/lib/x86_64-linux-gnu/libQt5Core.so.5: no version information available (required by /opt/sync-accounts-manager/SyncAccountsManager)
            /opt/sync-accounts-manager/SyncAccountsManager: /usr/lib/x86_64-linux-gnu/libQt5Core.so.5: no version information available (required by /opt/sync-accounts-manager/SyncAccountsManager)
            /opt/sync-accounts-manager/SyncAccountsManager: /usr/lib/x86_64-linux-gnu/libQt5Sql.so.5: no version information available (required by /opt/sync-accounts-manager/SyncAccountsManager)
                    linux-vdso.so.1 =>  (0x00007ffd5594c000)
                    libQt5Sql.so.5 => /usr/lib/x86_64-linux-gnu/libQt5Sql.so.5 (0x00007f86d6806000)
                    libQt5Core.so.5 => /usr/lib/x86_64-linux-gnu/libQt5Core.so.5 (0x00007f86d6160000)
                    libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f86d5e5b000)
                    libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f86d5c45000)
                    libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f86d5880000)
                    libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f86d5661000)
                    libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007f86d5448000)
                    libicui18n.so.52 => /usr/lib/x86_64-linux-gnu/libicui18n.so.52 (0x00007f86d5041000)
                    libicuuc.so.52 => /usr/lib/x86_64-linux-gnu/libicuuc.so.52 (0x00007f86d4cc7000)
                    libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f86d4ac3000)
                    libglib-2.0.so.0 => /lib/x86_64-linux-gnu/libglib-2.0.so.0 (0x00007f86d47bb000)
                    librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007f86d45b2000)
                    libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f86d42ac000)
                    /lib64/ld-linux-x86-64.so.2 (0x000055adc312e000)
                    libicudata.so.52 => /usr/lib/x86_64-linux-gnu/libicudata.so.52 (0x00007f86d2a3e000)
                    libpcre.so.3 => /lib/x86_64-linux-gnu/libpcre.so.3 (0x00007f86d2800000)
            mbnoimivm@ubuntu:~$
            
            kshegunovK A 2 Replies Last reply
            0
            • M mbnoimi

              I pushed my init project to github so because of this error I'm unable to connect to database:

              mbnoimivm@ubuntu:~$ /opt/sync-accounts-manager/SyncAccountsManager.sh
              QSqlDatabase: QMYSQL driver not loaded
              QSqlDatabase: available drivers: QSQLITE QMYSQL QMYSQL3 QPSQL QPSQL7
              Unable to connect!
              ^C
              mbnoimivm@ubuntu:~$ ldd /opt/sync-accounts-manager/SyncAccountsManager
              /opt/sync-accounts-manager/SyncAccountsManager: /usr/lib/x86_64-linux-gnu/libQt5Core.so.5: no version information available (required by /opt/sync-accounts-manager/SyncAccountsManager)
              /opt/sync-accounts-manager/SyncAccountsManager: /usr/lib/x86_64-linux-gnu/libQt5Core.so.5: no version information available (required by /opt/sync-accounts-manager/SyncAccountsManager)
              /opt/sync-accounts-manager/SyncAccountsManager: /usr/lib/x86_64-linux-gnu/libQt5Sql.so.5: no version information available (required by /opt/sync-accounts-manager/SyncAccountsManager)
                      linux-vdso.so.1 =>  (0x00007ffd5594c000)
                      libQt5Sql.so.5 => /usr/lib/x86_64-linux-gnu/libQt5Sql.so.5 (0x00007f86d6806000)
                      libQt5Core.so.5 => /usr/lib/x86_64-linux-gnu/libQt5Core.so.5 (0x00007f86d6160000)
                      libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f86d5e5b000)
                      libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f86d5c45000)
                      libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f86d5880000)
                      libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f86d5661000)
                      libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007f86d5448000)
                      libicui18n.so.52 => /usr/lib/x86_64-linux-gnu/libicui18n.so.52 (0x00007f86d5041000)
                      libicuuc.so.52 => /usr/lib/x86_64-linux-gnu/libicuuc.so.52 (0x00007f86d4cc7000)
                      libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f86d4ac3000)
                      libglib-2.0.so.0 => /lib/x86_64-linux-gnu/libglib-2.0.so.0 (0x00007f86d47bb000)
                      librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007f86d45b2000)
                      libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f86d42ac000)
                      /lib64/ld-linux-x86-64.so.2 (0x000055adc312e000)
                      libicudata.so.52 => /usr/lib/x86_64-linux-gnu/libicudata.so.52 (0x00007f86d2a3e000)
                      libpcre.so.3 => /lib/x86_64-linux-gnu/libpcre.so.3 (0x00007f86d2800000)
              mbnoimivm@ubuntu:~$
              
              kshegunovK Offline
              kshegunovK Offline
              kshegunov
              Moderators
              wrote on last edited by
              #10

              @mbnoimi
              Try running chrpath -d on your binary (and/or Qt) to remove the rpath.

              Found the suggestion on the deb mailing list.

              Read and abide by the Qt Code of Conduct

              1 Reply Last reply
              1
              • M mbnoimi

                I pushed my init project to github so because of this error I'm unable to connect to database:

                mbnoimivm@ubuntu:~$ /opt/sync-accounts-manager/SyncAccountsManager.sh
                QSqlDatabase: QMYSQL driver not loaded
                QSqlDatabase: available drivers: QSQLITE QMYSQL QMYSQL3 QPSQL QPSQL7
                Unable to connect!
                ^C
                mbnoimivm@ubuntu:~$ ldd /opt/sync-accounts-manager/SyncAccountsManager
                /opt/sync-accounts-manager/SyncAccountsManager: /usr/lib/x86_64-linux-gnu/libQt5Core.so.5: no version information available (required by /opt/sync-accounts-manager/SyncAccountsManager)
                /opt/sync-accounts-manager/SyncAccountsManager: /usr/lib/x86_64-linux-gnu/libQt5Core.so.5: no version information available (required by /opt/sync-accounts-manager/SyncAccountsManager)
                /opt/sync-accounts-manager/SyncAccountsManager: /usr/lib/x86_64-linux-gnu/libQt5Sql.so.5: no version information available (required by /opt/sync-accounts-manager/SyncAccountsManager)
                        linux-vdso.so.1 =>  (0x00007ffd5594c000)
                        libQt5Sql.so.5 => /usr/lib/x86_64-linux-gnu/libQt5Sql.so.5 (0x00007f86d6806000)
                        libQt5Core.so.5 => /usr/lib/x86_64-linux-gnu/libQt5Core.so.5 (0x00007f86d6160000)
                        libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f86d5e5b000)
                        libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f86d5c45000)
                        libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f86d5880000)
                        libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f86d5661000)
                        libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007f86d5448000)
                        libicui18n.so.52 => /usr/lib/x86_64-linux-gnu/libicui18n.so.52 (0x00007f86d5041000)
                        libicuuc.so.52 => /usr/lib/x86_64-linux-gnu/libicuuc.so.52 (0x00007f86d4cc7000)
                        libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f86d4ac3000)
                        libglib-2.0.so.0 => /lib/x86_64-linux-gnu/libglib-2.0.so.0 (0x00007f86d47bb000)
                        librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007f86d45b2000)
                        libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f86d42ac000)
                        /lib64/ld-linux-x86-64.so.2 (0x000055adc312e000)
                        libicudata.so.52 => /usr/lib/x86_64-linux-gnu/libicudata.so.52 (0x00007f86d2a3e000)
                        libpcre.so.3 => /lib/x86_64-linux-gnu/libpcre.so.3 (0x00007f86d2800000)
                mbnoimivm@ubuntu:~$
                
                A Offline
                A Offline
                ambershark
                wrote on last edited by
                #11

                @mbnoimi Do you have mysql as a plugin in Qt? If so you need to make sure you have the plugins set up on your machine properly.

                On your development machine they will work properly but when you distribute they may not.

                Usually I distribute then in the lib directory I use and then plugins, so something like this:

                myapp/
                   bin/
                      myapp (actual binary)
                      qt.conf
                   libs/
                      libmylib.so
                      libQt5Core.so.5
                      plugins/
                         platforms/
                            libqxcb.so (linux)
                         sqldrivers/
                            libsqlmysql.so
                   myapp (shell script to launch with a custom LD path)
                

                Inside the qt.conf file you need:

                [Paths]
                Plugins = ../libs/plugins
                

                Then I use a shell script to start my app:

                #!/bin/sh
                
                dir="$(dirname `readlink -f $0`)"
                LD_LIBRARY_PATH="$dir/libs:$LD_LIBRARY_PATH"
                QT_QPA_FONTDIR="$dir/fonts"
                export LD_LIBRARY_PATH QT_QPA_FONTDIR
                exec $dir/bin/myapp "$\@"
                

                Finally make sure you use chrpath to strip RPATH info out of your binaries (apps and libs) as suggested by @kshegunov . If they have hard coded paths as built on your system and those paths do not exist on your target system they will not work. If the path is gone it will use the LD_LIBRARY_PATH.

                Make sure you have the libraries you wanted to distribute in libs and all others (i.e. Qt) in LD path areas on your system and you should be good to go.

                That was a long answer to saying basically your app can't find the mysql Qt plugin. ;) Hopefully it helps though, I've gone through a lot of headache getting binary apps distributed for Linux in the past.

                My L-GPL'd C++ Logger github.com/ambershark-mike/sharklog

                M 1 Reply Last reply
                1
                • A ambershark

                  @mbnoimi Do you have mysql as a plugin in Qt? If so you need to make sure you have the plugins set up on your machine properly.

                  On your development machine they will work properly but when you distribute they may not.

                  Usually I distribute then in the lib directory I use and then plugins, so something like this:

                  myapp/
                     bin/
                        myapp (actual binary)
                        qt.conf
                     libs/
                        libmylib.so
                        libQt5Core.so.5
                        plugins/
                           platforms/
                              libqxcb.so (linux)
                           sqldrivers/
                              libsqlmysql.so
                     myapp (shell script to launch with a custom LD path)
                  

                  Inside the qt.conf file you need:

                  [Paths]
                  Plugins = ../libs/plugins
                  

                  Then I use a shell script to start my app:

                  #!/bin/sh
                  
                  dir="$(dirname `readlink -f $0`)"
                  LD_LIBRARY_PATH="$dir/libs:$LD_LIBRARY_PATH"
                  QT_QPA_FONTDIR="$dir/fonts"
                  export LD_LIBRARY_PATH QT_QPA_FONTDIR
                  exec $dir/bin/myapp "$\@"
                  

                  Finally make sure you use chrpath to strip RPATH info out of your binaries (apps and libs) as suggested by @kshegunov . If they have hard coded paths as built on your system and those paths do not exist on your target system they will not work. If the path is gone it will use the LD_LIBRARY_PATH.

                  Make sure you have the libraries you wanted to distribute in libs and all others (i.e. Qt) in LD path areas on your system and you should be good to go.

                  That was a long answer to saying basically your app can't find the mysql Qt plugin. ;) Hopefully it helps though, I've gone through a lot of headache getting binary apps distributed for Linux in the past.

                  M Offline
                  M Offline
                  mbnoimi
                  wrote on last edited by mbnoimi
                  #12

                  @ambershark I did as you advice but I'm still get same errors!

                  Files tree:

                  .
                  ├── bin
                  │   ├── qt.conf
                  │   └── SyncAccountsManager
                  ├── libs
                  │   ├── libicudata.so.56 -> libicudata.so.56.1
                  │   ├── libicudata.so.56.1
                  │   ├── libicui18n.so.56 -> libicui18n.so.56.1
                  │   ├── libicui18n.so.56.1
                  │   ├── libicuuc.so.56 -> libicuuc.so.56.1
                  │   ├── libicuuc.so.56.1
                  │   ├── libqgsttools_p.prl
                  │   ├── libqgsttools_p.so -> libqgsttools_p.so.1.0.0
                  │   ├── libqgsttools_p.so.1 -> libqgsttools_p.so.1.0.0
                  │   ├── libqgsttools_p.so.1.0 -> libqgsttools_p.so.1.0.0
                  │   ├── libqgsttools_p.so.1.0.0
                  │   ├── libQt5Core.so -> libQt5Core.so.5.7.0
                  │   ├── libQt5Core.so.5 -> libQt5Core.so.5.7.0
                  │   ├── libQt5Core.so.5.7 -> libQt5Core.so.5.7.0
                  │   ├── libQt5Core.so.5.7.0
                  │   ├── libQt5Gui.la
                  │   ├── libQt5Gui.prl
                  │   ├── libQt5Gui.so -> libQt5Gui.so.5.7.0
                  │   ├── libQt5Gui.so.5 -> libQt5Gui.so.5.7.0
                  │   ├── libQt5Gui.so.5.7 -> libQt5Gui.so.5.7.0
                  │   ├── libQt5Gui.so.5.7.0
                  │   ├── libQt5Sql.la
                  │   ├── libQt5Sql.prl
                  │   ├── libQt5Sql.so -> libQt5Sql.so.5.7.0
                  │   ├── libQt5Sql.so.5 -> libQt5Sql.so.5.7.0
                  │   ├── libQt5Sql.so.5.7 -> libQt5Sql.so.5.7.0
                  │   ├── libQt5Sql.so.5.7.0
                  │   └── plugins
                  │       ├── platforms
                  │       │   ├── libqeglfs.so
                  │       │   ├── libqlinuxfb.so
                  │       │   ├── libqminimalegl.so
                  │       │   ├── libqminimal.so
                  │       │   ├── libqoffscreen.so
                  │       │   └── libqxcb.so
                  │       └── sqldrivers
                  │           ├── libqsqlite.so
                  │           ├── libqsqlmysql.so
                  │           └── libqsqlpsql.so
                  └── SyncAccountsManager.sh
                  

                  SyncAccountsManager.pro

                  QT += core sql
                  QT -= gui
                  
                  TARGET = SyncAccountsManager
                  
                  CONFIG += c++11
                  CONFIG += release
                  
                  CONFIG += console
                  CONFIG -= app_bundle
                  
                  TEMPLATE = app
                  
                  SOURCES += src/main.cpp \
                      src/connectdb.cpp
                  
                  HEADERS += \
                      src/connectdb.h
                  
                  DESTDIR = bin
                  
                  win32 {
                      MOC_DIR = tmp-win32
                      UI_DIR = tmp-win32
                      UI_HEADERS_DIR = tmp-win32
                      UI_SOURCES_DIR = tmp-win32
                      OBJECTS_DIR = tmp-win32
                      RCC_DIR = tmp-win32
                  }
                  
                  linux {
                      MOC_DIR = tmp-lin64
                      UI_DIR = tmp-lin64
                      UI_HEADERS_DIR = tmp-lin64
                      UI_SOURCES_DIR = tmp-lin64
                      OBJECTS_DIR = tmp-lin64
                      RCC_DIR = tmp-lin64
                  #    QMAKE_POST_LINK = strip $${PWD}/$${DESTDIR}/$${TARGET}
                  #    QMAKE_RPATHDIR =
                  #    QMAKE_RPATHLINKDIR = # Possibly not needed
                      QMAKE_POST_LINK = $${PWD}/src/fix_executable.sh $${TARGET} $$(QTDIR) $${PWD}/$${DESTDIR} $${PWD}
                  
                  }
                  
                  

                  fix_executable.sh

                  #!/bin/sh
                  appname="$1"
                  qt="$2"
                  binpath="$3"
                  project_path="$4"
                  distro=$project_path/deb/files
                  
                  #### Clean the app
                  strip $binpath/$appname
                  chrpath -d $binpath/$appname
                  
                  #### Create files tree ####
                  cd $distro
                  rm -fr $distro/*
                  mkdir bin
                  mkdir -p libs/plugins
                  cp -fr $binpath $distro
                  chmod +x  $distro/bin/$appname.sh
                  mv -f $distro/bin/$appname.sh $distro
                  cp -fr $qt/lib/* $distro/libs
                  cp -fr $qt/plugins $distro/libs
                  

                  ldd result on the deployed machine:

                  mbnoimivm@ubuntu:~/files$ ./SyncAccountsManager.sh
                  QSqlDatabase: QMYSQL driver not loaded
                  QSqlDatabase: available drivers: QSQLITE QMYSQL QMYSQL3 QPSQL QPSQL7
                  Unable to connect!
                  ^C
                  mbnoimivm@ubuntu:~/files$ ldd bin/SyncAccountsManager
                  bin/SyncAccountsManager: /usr/lib/x86_64-linux-gnu/libQt5Core.so.5: no version information available (required by bin/SyncAccountsManager)
                  bin/SyncAccountsManager: /usr/lib/x86_64-linux-gnu/libQt5Core.so.5: no version information available (required by bin/SyncAccountsManager)
                  bin/SyncAccountsManager: /usr/lib/x86_64-linux-gnu/libQt5Sql.so.5: no version information available (required by bin/SyncAccountsManager)
                          linux-vdso.so.1 =>  (0x00007ffe1044f000)
                          libQt5Sql.so.5 => /usr/lib/x86_64-linux-gnu/libQt5Sql.so.5 (0x00007f62ea9c7000)
                          libQt5Core.so.5 => /usr/lib/x86_64-linux-gnu/libQt5Core.so.5 (0x00007f62ea321000)
                          libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f62ea01c000)
                          libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f62e9e06000)
                          libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f62e9a41000)
                          libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f62e9822000)
                          libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007f62e9609000)
                          libicui18n.so.52 => /usr/lib/x86_64-linux-gnu/libicui18n.so.52 (0x00007f62e9202000)
                          libicuuc.so.52 => /usr/lib/x86_64-linux-gnu/libicuuc.so.52 (0x00007f62e8e88000)
                          libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f62e8c84000)
                          libglib-2.0.so.0 => /lib/x86_64-linux-gnu/libglib-2.0.so.0 (0x00007f62e897c000)
                          librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007f62e8773000)
                          libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f62e846d000)
                          /lib64/ld-linux-x86-64.so.2 (0x00005653e78dc000)
                          libicudata.so.52 => /usr/lib/x86_64-linux-gnu/libicudata.so.52 (0x00007f62e6bff000)
                          libpcre.so.3 => /lib/x86_64-linux-gnu/libpcre.so.3 (0x00007f62e69c1000)
                  mbnoimivm@ubuntu:~/files$
                  
                  A 1 Reply Last reply
                  0
                  • M mbnoimi

                    @ambershark I did as you advice but I'm still get same errors!

                    Files tree:

                    .
                    ├── bin
                    │   ├── qt.conf
                    │   └── SyncAccountsManager
                    ├── libs
                    │   ├── libicudata.so.56 -> libicudata.so.56.1
                    │   ├── libicudata.so.56.1
                    │   ├── libicui18n.so.56 -> libicui18n.so.56.1
                    │   ├── libicui18n.so.56.1
                    │   ├── libicuuc.so.56 -> libicuuc.so.56.1
                    │   ├── libicuuc.so.56.1
                    │   ├── libqgsttools_p.prl
                    │   ├── libqgsttools_p.so -> libqgsttools_p.so.1.0.0
                    │   ├── libqgsttools_p.so.1 -> libqgsttools_p.so.1.0.0
                    │   ├── libqgsttools_p.so.1.0 -> libqgsttools_p.so.1.0.0
                    │   ├── libqgsttools_p.so.1.0.0
                    │   ├── libQt5Core.so -> libQt5Core.so.5.7.0
                    │   ├── libQt5Core.so.5 -> libQt5Core.so.5.7.0
                    │   ├── libQt5Core.so.5.7 -> libQt5Core.so.5.7.0
                    │   ├── libQt5Core.so.5.7.0
                    │   ├── libQt5Gui.la
                    │   ├── libQt5Gui.prl
                    │   ├── libQt5Gui.so -> libQt5Gui.so.5.7.0
                    │   ├── libQt5Gui.so.5 -> libQt5Gui.so.5.7.0
                    │   ├── libQt5Gui.so.5.7 -> libQt5Gui.so.5.7.0
                    │   ├── libQt5Gui.so.5.7.0
                    │   ├── libQt5Sql.la
                    │   ├── libQt5Sql.prl
                    │   ├── libQt5Sql.so -> libQt5Sql.so.5.7.0
                    │   ├── libQt5Sql.so.5 -> libQt5Sql.so.5.7.0
                    │   ├── libQt5Sql.so.5.7 -> libQt5Sql.so.5.7.0
                    │   ├── libQt5Sql.so.5.7.0
                    │   └── plugins
                    │       ├── platforms
                    │       │   ├── libqeglfs.so
                    │       │   ├── libqlinuxfb.so
                    │       │   ├── libqminimalegl.so
                    │       │   ├── libqminimal.so
                    │       │   ├── libqoffscreen.so
                    │       │   └── libqxcb.so
                    │       └── sqldrivers
                    │           ├── libqsqlite.so
                    │           ├── libqsqlmysql.so
                    │           └── libqsqlpsql.so
                    └── SyncAccountsManager.sh
                    

                    SyncAccountsManager.pro

                    QT += core sql
                    QT -= gui
                    
                    TARGET = SyncAccountsManager
                    
                    CONFIG += c++11
                    CONFIG += release
                    
                    CONFIG += console
                    CONFIG -= app_bundle
                    
                    TEMPLATE = app
                    
                    SOURCES += src/main.cpp \
                        src/connectdb.cpp
                    
                    HEADERS += \
                        src/connectdb.h
                    
                    DESTDIR = bin
                    
                    win32 {
                        MOC_DIR = tmp-win32
                        UI_DIR = tmp-win32
                        UI_HEADERS_DIR = tmp-win32
                        UI_SOURCES_DIR = tmp-win32
                        OBJECTS_DIR = tmp-win32
                        RCC_DIR = tmp-win32
                    }
                    
                    linux {
                        MOC_DIR = tmp-lin64
                        UI_DIR = tmp-lin64
                        UI_HEADERS_DIR = tmp-lin64
                        UI_SOURCES_DIR = tmp-lin64
                        OBJECTS_DIR = tmp-lin64
                        RCC_DIR = tmp-lin64
                    #    QMAKE_POST_LINK = strip $${PWD}/$${DESTDIR}/$${TARGET}
                    #    QMAKE_RPATHDIR =
                    #    QMAKE_RPATHLINKDIR = # Possibly not needed
                        QMAKE_POST_LINK = $${PWD}/src/fix_executable.sh $${TARGET} $$(QTDIR) $${PWD}/$${DESTDIR} $${PWD}
                    
                    }
                    
                    

                    fix_executable.sh

                    #!/bin/sh
                    appname="$1"
                    qt="$2"
                    binpath="$3"
                    project_path="$4"
                    distro=$project_path/deb/files
                    
                    #### Clean the app
                    strip $binpath/$appname
                    chrpath -d $binpath/$appname
                    
                    #### Create files tree ####
                    cd $distro
                    rm -fr $distro/*
                    mkdir bin
                    mkdir -p libs/plugins
                    cp -fr $binpath $distro
                    chmod +x  $distro/bin/$appname.sh
                    mv -f $distro/bin/$appname.sh $distro
                    cp -fr $qt/lib/* $distro/libs
                    cp -fr $qt/plugins $distro/libs
                    

                    ldd result on the deployed machine:

                    mbnoimivm@ubuntu:~/files$ ./SyncAccountsManager.sh
                    QSqlDatabase: QMYSQL driver not loaded
                    QSqlDatabase: available drivers: QSQLITE QMYSQL QMYSQL3 QPSQL QPSQL7
                    Unable to connect!
                    ^C
                    mbnoimivm@ubuntu:~/files$ ldd bin/SyncAccountsManager
                    bin/SyncAccountsManager: /usr/lib/x86_64-linux-gnu/libQt5Core.so.5: no version information available (required by bin/SyncAccountsManager)
                    bin/SyncAccountsManager: /usr/lib/x86_64-linux-gnu/libQt5Core.so.5: no version information available (required by bin/SyncAccountsManager)
                    bin/SyncAccountsManager: /usr/lib/x86_64-linux-gnu/libQt5Sql.so.5: no version information available (required by bin/SyncAccountsManager)
                            linux-vdso.so.1 =>  (0x00007ffe1044f000)
                            libQt5Sql.so.5 => /usr/lib/x86_64-linux-gnu/libQt5Sql.so.5 (0x00007f62ea9c7000)
                            libQt5Core.so.5 => /usr/lib/x86_64-linux-gnu/libQt5Core.so.5 (0x00007f62ea321000)
                            libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f62ea01c000)
                            libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f62e9e06000)
                            libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f62e9a41000)
                            libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f62e9822000)
                            libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007f62e9609000)
                            libicui18n.so.52 => /usr/lib/x86_64-linux-gnu/libicui18n.so.52 (0x00007f62e9202000)
                            libicuuc.so.52 => /usr/lib/x86_64-linux-gnu/libicuuc.so.52 (0x00007f62e8e88000)
                            libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f62e8c84000)
                            libglib-2.0.so.0 => /lib/x86_64-linux-gnu/libglib-2.0.so.0 (0x00007f62e897c000)
                            librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007f62e8773000)
                            libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f62e846d000)
                            /lib64/ld-linux-x86-64.so.2 (0x00005653e78dc000)
                            libicudata.so.52 => /usr/lib/x86_64-linux-gnu/libicudata.so.52 (0x00007f62e6bff000)
                            libpcre.so.3 => /lib/x86_64-linux-gnu/libpcre.so.3 (0x00007f62e69c1000)
                    mbnoimivm@ubuntu:~/files$
                    
                    A Offline
                    A Offline
                    ambershark
                    wrote on last edited by ambershark
                    #13

                    ldd result on the deployed machine:

                    mbnoimivm@ubuntu:~/files$ ./SyncAccountsManager.sh
                    QSqlDatabase: QMYSQL driver not loaded
                    QSqlDatabase: available drivers: QSQLITE QMYSQL QMYSQL3 QPSQL QPSQL7
                    Unable to connect!
                    ^C
                    mbnoimivm@ubuntu:~/files$ ldd bin/SyncAccountsManager
                    bin/SyncAccountsManager: /usr/lib/x86_64-linux-gnu/libQt5Core.so.5: no version information available (required by bin/SyncAccountsManager)
                    bin/SyncAccountsManager: /usr/lib/x86_64-linux-gnu/libQt5Core.so.5: no version information available (required by bin/SyncAccountsManager)
                    bin/SyncAccountsManager: /usr/lib/x86_64-linux-gnu/libQt5Sql.so.5: no version information available (required by bin/SyncAccountsManager)
                            linux-vdso.so.1 =>  (0x00007ffe1044f000)
                            libQt5Sql.so.5 => /usr/lib/x86_64-linux-gnu/libQt5Sql.so.5 (0x00007f62ea9c7000)
                            libQt5Core.so.5 => /usr/lib/x86_64-linux-gnu/libQt5Core.so.5 (0x00007f62ea321000)
                            libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f62ea01c000)
                            libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f62e9e06000)
                            libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f62e9a41000)
                            libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f62e9822000)
                            libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007f62e9609000)
                            libicui18n.so.52 => /usr/lib/x86_64-linux-gnu/libicui18n.so.52 (0x00007f62e9202000)
                            libicuuc.so.52 => /usr/lib/x86_64-linux-gnu/libicuuc.so.52 (0x00007f62e8e88000)
                            libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f62e8c84000)
                            libglib-2.0.so.0 => /lib/x86_64-linux-gnu/libglib-2.0.so.0 (0x00007f62e897c000)
                            librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007f62e8773000)
                            libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f62e846d000)
                            /lib64/ld-linux-x86-64.so.2 (0x00005653e78dc000)
                            libicudata.so.52 => /usr/lib/x86_64-linux-gnu/libicudata.so.52 (0x00007f62e6bff000)
                            libpcre.so.3 => /lib/x86_64-linux-gnu/libpcre.so.3 (0x00007f62e69c1000)
                    mbnoimivm@ubuntu:~/files$
                    

                    Ok so it looks like it is picking up your system Qt and not the one you want it to use. That is controlled with LD_LIBRARY_PATH.. In your synaccountsmanager.sh it may be working but since you used ldd bin/SyncAccountsManager it didn't use the ld library path properly so it could be right but from what I'm looking at it's definitely not.

                    So run ldd like this:

                    $ cd yourapp/bin
                    $ LD_LIBRARY_PATH="../libs" ldd ./SyncAccountsManager
                    

                    That should give us the output we want. Also make sure your .sh start script sets your LD_LIBRARY_PATH just like that. You could try running it straight on the command line like that and see if it works. If not the ldd output will be useful at least.

                    One of the things that is most concerning is this line:

                    bin/SyncAccountsManager: /usr/lib/x86_64-linux-gnu/libQt5Sql.so.5: no version information available (required by bin/SyncAccountsManager)

                    Also I don't see libQt5Sql.so.5 in your libs directory. I'm sure you need that if you're using SQL. ;)

                    My L-GPL'd C++ Logger github.com/ambershark-mike/sharklog

                    M 1 Reply Last reply
                    1
                    • A ambershark

                      ldd result on the deployed machine:

                      mbnoimivm@ubuntu:~/files$ ./SyncAccountsManager.sh
                      QSqlDatabase: QMYSQL driver not loaded
                      QSqlDatabase: available drivers: QSQLITE QMYSQL QMYSQL3 QPSQL QPSQL7
                      Unable to connect!
                      ^C
                      mbnoimivm@ubuntu:~/files$ ldd bin/SyncAccountsManager
                      bin/SyncAccountsManager: /usr/lib/x86_64-linux-gnu/libQt5Core.so.5: no version information available (required by bin/SyncAccountsManager)
                      bin/SyncAccountsManager: /usr/lib/x86_64-linux-gnu/libQt5Core.so.5: no version information available (required by bin/SyncAccountsManager)
                      bin/SyncAccountsManager: /usr/lib/x86_64-linux-gnu/libQt5Sql.so.5: no version information available (required by bin/SyncAccountsManager)
                              linux-vdso.so.1 =>  (0x00007ffe1044f000)
                              libQt5Sql.so.5 => /usr/lib/x86_64-linux-gnu/libQt5Sql.so.5 (0x00007f62ea9c7000)
                              libQt5Core.so.5 => /usr/lib/x86_64-linux-gnu/libQt5Core.so.5 (0x00007f62ea321000)
                              libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f62ea01c000)
                              libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f62e9e06000)
                              libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f62e9a41000)
                              libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f62e9822000)
                              libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007f62e9609000)
                              libicui18n.so.52 => /usr/lib/x86_64-linux-gnu/libicui18n.so.52 (0x00007f62e9202000)
                              libicuuc.so.52 => /usr/lib/x86_64-linux-gnu/libicuuc.so.52 (0x00007f62e8e88000)
                              libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f62e8c84000)
                              libglib-2.0.so.0 => /lib/x86_64-linux-gnu/libglib-2.0.so.0 (0x00007f62e897c000)
                              librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007f62e8773000)
                              libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f62e846d000)
                              /lib64/ld-linux-x86-64.so.2 (0x00005653e78dc000)
                              libicudata.so.52 => /usr/lib/x86_64-linux-gnu/libicudata.so.52 (0x00007f62e6bff000)
                              libpcre.so.3 => /lib/x86_64-linux-gnu/libpcre.so.3 (0x00007f62e69c1000)
                      mbnoimivm@ubuntu:~/files$
                      

                      Ok so it looks like it is picking up your system Qt and not the one you want it to use. That is controlled with LD_LIBRARY_PATH.. In your synaccountsmanager.sh it may be working but since you used ldd bin/SyncAccountsManager it didn't use the ld library path properly so it could be right but from what I'm looking at it's definitely not.

                      So run ldd like this:

                      $ cd yourapp/bin
                      $ LD_LIBRARY_PATH="../libs" ldd ./SyncAccountsManager
                      

                      That should give us the output we want. Also make sure your .sh start script sets your LD_LIBRARY_PATH just like that. You could try running it straight on the command line like that and see if it works. If not the ldd output will be useful at least.

                      One of the things that is most concerning is this line:

                      bin/SyncAccountsManager: /usr/lib/x86_64-linux-gnu/libQt5Sql.so.5: no version information available (required by bin/SyncAccountsManager)

                      Also I don't see libQt5Sql.so.5 in your libs directory. I'm sure you need that if you're using SQL. ;)

                      M Offline
                      M Offline
                      mbnoimi
                      wrote on last edited by
                      #14

                      @ambershark said in Unable to deploy Qt app under Linux:

                      Ok so it looks like it is picking up your system Qt and not the one you want it to use. That is controlled with LD_LIBRARY_PATH.. In your synaccountsmanager.sh it may be working but since you used ldd bin/SyncAccountsManager it didn't use the ld library path properly so it could be right but from what I'm looking at it's definitely not.

                      The content of SyncAccountsManager.sh

                      #!/bin/sh
                      
                      dir="$(dirname `readlink -f $0`)"
                      LD_LIBRARY_PATH="$dir/libs:$LD_LIBRARY_PATH"
                      QT_QPA_FONTDIR="$dir/fonts"
                      export LD_LIBRARY_PATH QT_QPA_FONTDIR
                      exec $dir/bin/SyncAccountsManagermyapp "$\@"
                      

                      So run ldd like this:
                      $ cd yourapp/bin
                      $ LD_LIBRARY_PATH="../libs" ldd ./SyncAccountsManager

                      That should give us the output we want. Also make sure your .sh start script sets your LD_LIBRARY_PATH just like that. You could try running it straight on the command line like that and see if it works.

                      The result of ldd:

                      mbnoimivm@ubuntu:~$ cd files/bin
                      mbnoimivm@ubuntu:~/files/bin$ LD_LIBRARY_PATH="../libs" ldd ./SyncAccountsManager
                              linux-vdso.so.1 =>  (0x00007ffe11f17000)
                              libQt5Sql.so.5 => ../libs/libQt5Sql.so.5 (0x00007f73059e7000)
                              libQt5Core.so.5 => ../libs/libQt5Core.so.5 (0x00007f73052cc000)
                              libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f7304fbf000)
                              libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f7304da9000)
                              libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f73049e4000)
                              libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f73047c5000)
                              libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f73044bf000)
                              libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007f73042a6000)
                              libicui18n.so.56 => ../libs/libicui18n.so.56 (0x00007f7303e0b000)
                              libicuuc.so.56 => ../libs/libicuuc.so.56 (0x00007f7303a53000)
                              libicudata.so.56 => ../libs/libicudata.so.56 (0x00007f7302070000)
                              libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f7301e6b000)
                              libgthread-2.0.so.0 => /usr/lib/x86_64-linux-gnu/libgthread-2.0.so.0 (0x00007f7301c69000)
                              librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007f7301a61000)
                              libglib-2.0.so.0 => /lib/x86_64-linux-gnu/libglib-2.0.so.0 (0x00007f7301758000)
                              /lib64/ld-linux-x86-64.so.2 (0x000055c051da4000)
                              libpcre.so.3 => /lib/x86_64-linux-gnu/libpcre.so.3 (0x00007f730151a000)
                      mbnoimivm@ubuntu:~/files/bin$
                      

                      Also I don't see libQt5Sql.so.5 in your libs directory. I'm sure you need that if you're using SQL. ;)

                      No, it's in my files tree see above please.

                      M 1 Reply Last reply
                      0
                      • M mbnoimi

                        @ambershark said in Unable to deploy Qt app under Linux:

                        Ok so it looks like it is picking up your system Qt and not the one you want it to use. That is controlled with LD_LIBRARY_PATH.. In your synaccountsmanager.sh it may be working but since you used ldd bin/SyncAccountsManager it didn't use the ld library path properly so it could be right but from what I'm looking at it's definitely not.

                        The content of SyncAccountsManager.sh

                        #!/bin/sh
                        
                        dir="$(dirname `readlink -f $0`)"
                        LD_LIBRARY_PATH="$dir/libs:$LD_LIBRARY_PATH"
                        QT_QPA_FONTDIR="$dir/fonts"
                        export LD_LIBRARY_PATH QT_QPA_FONTDIR
                        exec $dir/bin/SyncAccountsManagermyapp "$\@"
                        

                        So run ldd like this:
                        $ cd yourapp/bin
                        $ LD_LIBRARY_PATH="../libs" ldd ./SyncAccountsManager

                        That should give us the output we want. Also make sure your .sh start script sets your LD_LIBRARY_PATH just like that. You could try running it straight on the command line like that and see if it works.

                        The result of ldd:

                        mbnoimivm@ubuntu:~$ cd files/bin
                        mbnoimivm@ubuntu:~/files/bin$ LD_LIBRARY_PATH="../libs" ldd ./SyncAccountsManager
                                linux-vdso.so.1 =>  (0x00007ffe11f17000)
                                libQt5Sql.so.5 => ../libs/libQt5Sql.so.5 (0x00007f73059e7000)
                                libQt5Core.so.5 => ../libs/libQt5Core.so.5 (0x00007f73052cc000)
                                libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f7304fbf000)
                                libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f7304da9000)
                                libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f73049e4000)
                                libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f73047c5000)
                                libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f73044bf000)
                                libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007f73042a6000)
                                libicui18n.so.56 => ../libs/libicui18n.so.56 (0x00007f7303e0b000)
                                libicuuc.so.56 => ../libs/libicuuc.so.56 (0x00007f7303a53000)
                                libicudata.so.56 => ../libs/libicudata.so.56 (0x00007f7302070000)
                                libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f7301e6b000)
                                libgthread-2.0.so.0 => /usr/lib/x86_64-linux-gnu/libgthread-2.0.so.0 (0x00007f7301c69000)
                                librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007f7301a61000)
                                libglib-2.0.so.0 => /lib/x86_64-linux-gnu/libglib-2.0.so.0 (0x00007f7301758000)
                                /lib64/ld-linux-x86-64.so.2 (0x000055c051da4000)
                                libpcre.so.3 => /lib/x86_64-linux-gnu/libpcre.so.3 (0x00007f730151a000)
                        mbnoimivm@ubuntu:~/files/bin$
                        

                        Also I don't see libQt5Sql.so.5 in your libs directory. I'm sure you need that if you're using SQL. ;)

                        No, it's in my files tree see above please.

                        M Offline
                        M Offline
                        mbnoimi
                        wrote on last edited by
                        #15

                        I tried the following but I got same result:

                        mbnoimivm@ubuntu:~/files/bin$ LD_LIBRARY_PATH="../libs" ./SyncAccountsManager
                        QSqlDatabase: QMYSQL driver not loaded
                        QSqlDatabase: available drivers: QSQLITE QMYSQL QMYSQL3 QPSQL QPSQL7
                        Unable to connect!
                        ^C
                        mbnoimivm@ubuntu:~/files/bin$
                        
                        1 Reply Last reply
                        0
                        • A Offline
                          A Offline
                          ambershark
                          wrote on last edited by
                          #16

                          Sure is in that list, I must have missed it.. Ok so let's try moving those sqldrivers... Sometimes I have issues with where Qt looks for plugins.

                          Instead of plugins/sqldrivers try making a copy of those libsql.so files in plugins/. Then see if that works. I'll try to think of anything else that might be going on while you try that.

                          My L-GPL'd C++ Logger github.com/ambershark-mike/sharklog

                          M 1 Reply Last reply
                          0
                          • A Offline
                            A Offline
                            ambershark
                            wrote on last edited by ambershark
                            #17

                            Ok then after that lets see if this is a mysql problem and not a Qt one. Run ldd libqsqlmysql.so and post that output. It may be looking for a mysql library that was upgraded and no longer on your system.

                            Oh and it shouldn't affect the driver only class availability but make sure you have QT += sql in your pro file. Just in case it does affect it... But I doubt it will.

                            My L-GPL'd C++ Logger github.com/ambershark-mike/sharklog

                            M 1 Reply Last reply
                            0
                            • A ambershark

                              Sure is in that list, I must have missed it.. Ok so let's try moving those sqldrivers... Sometimes I have issues with where Qt looks for plugins.

                              Instead of plugins/sqldrivers try making a copy of those libsql.so files in plugins/. Then see if that works. I'll try to think of anything else that might be going on while you try that.

                              M Offline
                              M Offline
                              mbnoimi
                              wrote on last edited by
                              #18

                              @ambershark said in Unable to deploy Qt app under Linux:

                              Instead of plugins/sqldrivers try making a copy of those libsql.so files in plugins/. Then see if that works. I'll try to think of anything else that might be going on while you try that.

                              Same error :(

                              mbnoimivm@ubuntu:~$ files/SyncAccountsManager.sh
                              QSqlDatabase: QMYSQL driver not loaded
                              QSqlDatabase: available drivers: QSQLITE QMYSQL QMYSQL3 QPSQL QPSQL7
                              Unable to connect!
                              ^C
                              mbnoimivm@ubuntu:~$ tree -R files/
                              files/
                              ├── bin
                              │   ├── qt.conf
                              │   └── SyncAccountsManager
                              ├── libs
                              │   ├── libicudata.so.56
                              │   ├── libicudata.so.56.1
                              │   ├── libicui18n.so.56
                              │   ├── libicui18n.so.56.1
                              │   ├── libicuuc.so.56
                              │   ├── libicuuc.so.56.1
                              │   ├── libqgsttools_p.prl
                              │   ├── libqgsttools_p.so
                              │   ├── libqgsttools_p.so.1
                              │   ├── libqgsttools_p.so.1.0
                              │   ├── libqgsttools_p.so.1.0.0
                              │   ├── libQt5Core.so
                              │   ├── libQt5Core.so.5
                              │   ├── libQt5Core.so.5.7
                              │   ├── libQt5Core.so.5.7.0
                              │   ├── libQt5Sql.la
                              │   ├── libQt5Sql.prl
                              │   ├── libQt5Sql.so
                              │   ├── libQt5Sql.so.5
                              │   ├── libQt5Sql.so.5.7
                              │   ├── libQt5Sql.so.5.7.0
                              │   └── plugins
                              │       ├── libqsqlite.so
                              │       ├── libqsqlmysql.so
                              │       ├── libqsqlpsql.so
                              │       ├── libQt5Sql.la
                              │       ├── libQt5Sql.prl
                              │       ├── libQt5Sql.so
                              │       ├── libQt5Sql.so.5
                              │       ├── libQt5Sql.so.5.7
                              │       ├── libQt5Sql.so.5.7.0
                              │       ├── platforms
                              │       │   ├── libqeglfs.so
                              │       │   ├── libqlinuxfb.so
                              │       │   ├── libqminimalegl.so
                              │       │   ├── libqminimal.so
                              │       │   ├── libqoffscreen.so
                              │       │   └── libqxcb.so
                              │       └── sqldrivers
                              │           ├── libqsqlite.so
                              │           ├── libqsqlmysql.so
                              │           └── libqsqlpsql.so
                              └── SyncAccountsManager.sh
                              5 directories, 42 files
                              mbnoimivm@ubuntu:~$
                              
                              kshegunovK 1 Reply Last reply
                              0
                              • A ambershark

                                Ok then after that lets see if this is a mysql problem and not a Qt one. Run ldd libqsqlmysql.so and post that output. It may be looking for a mysql library that was upgraded and no longer on your system.

                                Oh and it shouldn't affect the driver only class availability but make sure you have QT += sql in your pro file. Just in case it does affect it... But I doubt it will.

                                M Offline
                                M Offline
                                mbnoimi
                                wrote on last edited by
                                #19

                                @ambershark said in Unable to deploy Qt app under Linux:

                                Ok then after that lets see if this is a mysql problem and not a Qt one. Run ldd libqsqlmysql.so and post that output. It may be looking for a mysql library that was upgraded and no longer on your system.

                                mbnoimivm@ubuntu:~/files/libs/plugins/sqldrivers$ ldd libqsqlmysql.so
                                ./libqsqlmysql.so: /usr/lib/x86_64-linux-gnu/libQt5Sql.so.5: no version information available (required by ./libqsqlmysql.so)
                                ./libqsqlmysql.so: /usr/lib/x86_64-linux-gnu/libQt5Sql.so.5: no version information available (required by ./libqsqlmysql.so)
                                ./libqsqlmysql.so: /usr/lib/x86_64-linux-gnu/libstdc++.so.6: version `CXXABI_1.3.9' not found (required by ./libqsqlmysql.so)
                                ./libqsqlmysql.so: /usr/lib/x86_64-linux-gnu/libQt5Core.so.5: no version information available (required by ./libqsqlmysql.so)
                                ./libqsqlmysql.so: /usr/lib/x86_64-linux-gnu/libQt5Core.so.5: no version information available (required by ./libqsqlmysql.so)
                                ./libqsqlmysql.so: /usr/lib/x86_64-linux-gnu/libQt5Core.so.5: no version information available (required by ./libqsqlmysql.so)
                                        linux-vdso.so.1 =>  (0x00007fff87591000)
                                        libmysqlclient.so.20 => /usr/lib/x86_64-linux-gnu/libmysqlclient.so.20 (0x00007faa39173000)
                                        libQt5Sql.so.5 => /usr/lib/x86_64-linux-gnu/libQt5Sql.so.5 (0x00007faa38f34000)
                                        libQt5Core.so.5 => /usr/lib/x86_64-linux-gnu/libQt5Core.so.5 (0x00007faa3888d000)
                                        libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007faa38589000)
                                        libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007faa381c4000)
                                        libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007faa37fbf000)
                                        libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007faa37da1000)
                                        libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007faa37a9b000)
                                        libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007faa37884000)
                                        libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007faa3766b000)
                                        libicui18n.so.52 => /usr/lib/x86_64-linux-gnu/libicui18n.so.52 (0x00007faa37264000)
                                        libicuuc.so.52 => /usr/lib/x86_64-linux-gnu/libicuuc.so.52 (0x00007faa36eea000)
                                        libglib-2.0.so.0 => /lib/x86_64-linux-gnu/libglib-2.0.so.0 (0x00007faa36be2000)
                                        librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007faa369da000)
                                        /lib64/ld-linux-x86-64.so.2 (0x000055741e96f000)
                                        libicudata.so.52 => /usr/lib/x86_64-linux-gnu/libicudata.so.52 (0x00007faa3516c000)
                                        libpcre.so.3 => /lib/x86_64-linux-gnu/libpcre.so.3 (0x00007faa34f2e000)
                                mbnoimivm@ubuntu:~/files/libs/plugins/sqldrivers$
                                
                                1 Reply Last reply
                                0
                                • M Offline
                                  M Offline
                                  mbnoimi
                                  wrote on last edited by
                                  #20

                                  I tried to apply strip but unfortunately it didn't fix the problem

                                  mbnoimivm@ubuntu:~/files/libs/plugins/sqldrivers$ strip libqsqlmysql.so
                                  mbnoimivm@ubuntu:~/files/libs/plugins/sqldrivers$ ldd libqsqlmysql.so
                                  ./libqsqlmysql.so: /usr/lib/x86_64-linux-gnu/libQt5Sql.so.5: no version information available (required by ./libqsqlmysql.so)
                                  ./libqsqlmysql.so: /usr/lib/x86_64-linux-gnu/libQt5Sql.so.5: no version information available (required by ./libqsqlmysql.so)
                                  ./libqsqlmysql.so: /usr/lib/x86_64-linux-gnu/libstdc++.so.6: version `CXXABI_1.3.9' not found (required by ./libqsqlmysql.so)
                                  ./libqsqlmysql.so: /usr/lib/x86_64-linux-gnu/libQt5Core.so.5: no version information available (required by ./libqsqlmysql.so)
                                  ./libqsqlmysql.so: /usr/lib/x86_64-linux-gnu/libQt5Core.so.5: no version information available (required by ./libqsqlmysql.so)
                                  ./libqsqlmysql.so: /usr/lib/x86_64-linux-gnu/libQt5Core.so.5: no version information available (required by ./libqsqlmysql.so)
                                          linux-vdso.so.1 =>  (0x00007ffd21f90000)
                                          libmysqlclient.so.20 => /usr/lib/x86_64-linux-gnu/libmysqlclient.so.20 (0x00007fa3fe87c000)
                                          libQt5Sql.so.5 => /usr/lib/x86_64-linux-gnu/libQt5Sql.so.5 (0x00007fa3fe63d000)
                                          libQt5Core.so.5 => /usr/lib/x86_64-linux-gnu/libQt5Core.so.5 (0x00007fa3fdf96000)
                                          libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007fa3fdc92000)
                                          libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fa3fd8cd000)
                                          libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007fa3fd6c8000)
                                          libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007fa3fd4aa000)
                                          libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007fa3fd1a4000)
                                          libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007fa3fcf8d000)
                                          libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007fa3fcd74000)
                                          libicui18n.so.52 => /usr/lib/x86_64-linux-gnu/libicui18n.so.52 (0x00007fa3fc96d000)
                                          libicuuc.so.52 => /usr/lib/x86_64-linux-gnu/libicuuc.so.52 (0x00007fa3fc5f3000)
                                          libglib-2.0.so.0 => /lib/x86_64-linux-gnu/libglib-2.0.so.0 (0x00007fa3fc2eb000)
                                          librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007fa3fc0e3000)
                                          /lib64/ld-linux-x86-64.so.2 (0x0000562224202000)
                                          libicudata.so.52 => /usr/lib/x86_64-linux-gnu/libicudata.so.52 (0x00007fa3fa875000)
                                          libpcre.so.3 => /lib/x86_64-linux-gnu/libpcre.so.3 (0x00007fa3fa637000)
                                  mbnoimivm@ubuntu:~/files/libs/plugins/sqldrivers$
                                  
                                  1 Reply Last reply
                                  0
                                  • M Offline
                                    M Offline
                                    mbnoimi
                                    wrote on last edited by mbnoimi
                                    #21

                                    IMPORTANT:
                                    Although this distro works fine on the original PC but I get this error by ldd:

                                    mbnoimi@mbnoimi-laptop ~/HPC/SyncAccountsManager/deb/files/libs/plugins/sqldrivers $ ldd libqsqlmysql.so 
                                    ./libqsqlmysql.so: /usr/lib/x86_64-linux-gnu/libQt5Sql.so.5: version `Qt_5_PRIVATE_API' not found (required by ./libqsqlmysql.so)
                                    ./libqsqlmysql.so: /usr/lib/x86_64-linux-gnu/libQt5Sql.so.5: version `Qt_5' not found (required by ./libqsqlmysql.so)
                                    ./libqsqlmysql.so: /usr/lib/x86_64-linux-gnu/libQt5Core.so.5: version `Qt_5.7' not found (required by ./libqsqlmysql.so)
                                    ./libqsqlmysql.so: /usr/lib/x86_64-linux-gnu/libQt5Core.so.5: version `Qt_5_PRIVATE_API' not found (required by ./libqsqlmysql.so)
                                    ./libqsqlmysql.so: /usr/lib/x86_64-linux-gnu/libQt5Core.so.5: version `Qt_5' not found (required by ./libqsqlmysql.so)
                                    	linux-vdso.so.1 =>  (0x00007ffe9f9fd000)
                                    	libmysqlclient.so.20 => /usr/lib/x86_64-linux-gnu/libmysqlclient.so.20 (0x00007f8bd5f9b000)
                                    	libQt5Sql.so.5 => /usr/lib/x86_64-linux-gnu/libQt5Sql.so.5 (0x00007f8bd5f59000)
                                    	libQt5Core.so.5 => /usr/lib/x86_64-linux-gnu/libQt5Core.so.5 (0x00007f8bd5a82000)
                                    	libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f8bd5700000)
                                    	libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f8bd5337000)
                                    	libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007f8bd511c000)
                                    	libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f8bd4f18000)
                                    	libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f8bd4cfb000)
                                    	libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f8bd49f1000)
                                    	libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f8bd47db000)
                                    	libicui18n.so.55 => /usr/lib/x86_64-linux-gnu/libicui18n.so.55 (0x00007f8bd4379000)
                                    	libicuuc.so.55 => /usr/lib/x86_64-linux-gnu/libicuuc.so.55 (0x00007f8bd3fe4000)
                                    	libpcre16.so.3 => /usr/lib/x86_64-linux-gnu/libpcre16.so.3 (0x00007f8bd3d7e000)
                                    	libglib-2.0.so.0 => /lib/x86_64-linux-gnu/libglib-2.0.so.0 (0x00007f8bd3a6d000)
                                    	librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007f8bd3864000)
                                    	/lib64/ld-linux-x86-64.so.2 (0x0000563fd9f32000)
                                    	libicudata.so.55 => /usr/lib/x86_64-linux-gnu/libicudata.so.55 (0x00007f8bd1dad000)
                                    	libpcre.so.3 => /lib/x86_64-linux-gnu/libpcre.so.3 (0x00007f8bd1b3c000)
                                    mbnoimi@mbnoimi-laptop ~/HPC/SyncAccountsManager/deb/files/libs/plugins/sqldrivers $ 
                                    
                                    
                                    1 Reply Last reply
                                    0
                                    • M mbnoimi

                                      @ambershark said in Unable to deploy Qt app under Linux:

                                      Instead of plugins/sqldrivers try making a copy of those libsql.so files in plugins/. Then see if that works. I'll try to think of anything else that might be going on while you try that.

                                      Same error :(

                                      mbnoimivm@ubuntu:~$ files/SyncAccountsManager.sh
                                      QSqlDatabase: QMYSQL driver not loaded
                                      QSqlDatabase: available drivers: QSQLITE QMYSQL QMYSQL3 QPSQL QPSQL7
                                      Unable to connect!
                                      ^C
                                      mbnoimivm@ubuntu:~$ tree -R files/
                                      files/
                                      ├── bin
                                      │   ├── qt.conf
                                      │   └── SyncAccountsManager
                                      ├── libs
                                      │   ├── libicudata.so.56
                                      │   ├── libicudata.so.56.1
                                      │   ├── libicui18n.so.56
                                      │   ├── libicui18n.so.56.1
                                      │   ├── libicuuc.so.56
                                      │   ├── libicuuc.so.56.1
                                      │   ├── libqgsttools_p.prl
                                      │   ├── libqgsttools_p.so
                                      │   ├── libqgsttools_p.so.1
                                      │   ├── libqgsttools_p.so.1.0
                                      │   ├── libqgsttools_p.so.1.0.0
                                      │   ├── libQt5Core.so
                                      │   ├── libQt5Core.so.5
                                      │   ├── libQt5Core.so.5.7
                                      │   ├── libQt5Core.so.5.7.0
                                      │   ├── libQt5Sql.la
                                      │   ├── libQt5Sql.prl
                                      │   ├── libQt5Sql.so
                                      │   ├── libQt5Sql.so.5
                                      │   ├── libQt5Sql.so.5.7
                                      │   ├── libQt5Sql.so.5.7.0
                                      │   └── plugins
                                      │       ├── libqsqlite.so
                                      │       ├── libqsqlmysql.so
                                      │       ├── libqsqlpsql.so
                                      │       ├── libQt5Sql.la
                                      │       ├── libQt5Sql.prl
                                      │       ├── libQt5Sql.so
                                      │       ├── libQt5Sql.so.5
                                      │       ├── libQt5Sql.so.5.7
                                      │       ├── libQt5Sql.so.5.7.0
                                      │       ├── platforms
                                      │       │   ├── libqeglfs.so
                                      │       │   ├── libqlinuxfb.so
                                      │       │   ├── libqminimalegl.so
                                      │       │   ├── libqminimal.so
                                      │       │   ├── libqoffscreen.so
                                      │       │   └── libqxcb.so
                                      │       └── sqldrivers
                                      │           ├── libqsqlite.so
                                      │           ├── libqsqlmysql.so
                                      │           └── libqsqlpsql.so
                                      └── SyncAccountsManager.sh
                                      5 directories, 42 files
                                      mbnoimivm@ubuntu:~$
                                      
                                      kshegunovK Offline
                                      kshegunovK Offline
                                      kshegunov
                                      Moderators
                                      wrote on last edited by kshegunov
                                      #22

                                      @mbnoimi
                                      How did any of this have anything to do with strip or .deb packages?

                                      Here: http://doc.qt.io/qt-5/linux-deployment.html#creating-the-application-package
                                      You haven't followed the required directory structure and you're executing the application from a directory different from qt.conf's location.

                                      Warning: On Linux, this function will try to get the path from the /proc file system. If that fails, it assumes that argv[0] contains the absolute file name of the executable. The function also assumes that the current directory has not been changed by the application.

                                      From here. I'd start by fixing up the shell script. You don't escape the file name of the script but instead quote the whole commands, this doesn't make much sense. Try something like this:

                                      #!/bin/sh
                                      
                                      # Don't spawn children shells unnecessarily by using `
                                      dir=$(dirname $(readlink -f "$0"))
                                      
                                      # The following might happen to be pretty important
                                      cd $dir'/bin'
                                      
                                      # Execute from the current shell's context and no need to export if you don't spawn a new shell process
                                      app=$dir'/bin/SyncAccountsManagermyapp' 
                                      
                                      LD_LIBRARY_PATH=$dir'/libs:'$LD_LIBRARY_PATH QT_QPA_FONTDIR=$dir'/fonts' $app "$@"
                                      

                                      Read and abide by the Qt Code of Conduct

                                      M A 2 Replies Last reply
                                      0
                                      • kshegunovK kshegunov

                                        @mbnoimi
                                        How did any of this have anything to do with strip or .deb packages?

                                        Here: http://doc.qt.io/qt-5/linux-deployment.html#creating-the-application-package
                                        You haven't followed the required directory structure and you're executing the application from a directory different from qt.conf's location.

                                        Warning: On Linux, this function will try to get the path from the /proc file system. If that fails, it assumes that argv[0] contains the absolute file name of the executable. The function also assumes that the current directory has not been changed by the application.

                                        From here. I'd start by fixing up the shell script. You don't escape the file name of the script but instead quote the whole commands, this doesn't make much sense. Try something like this:

                                        #!/bin/sh
                                        
                                        # Don't spawn children shells unnecessarily by using `
                                        dir=$(dirname $(readlink -f "$0"))
                                        
                                        # The following might happen to be pretty important
                                        cd $dir'/bin'
                                        
                                        # Execute from the current shell's context and no need to export if you don't spawn a new shell process
                                        app=$dir'/bin/SyncAccountsManagermyapp' 
                                        
                                        LD_LIBRARY_PATH=$dir'/libs:'$LD_LIBRARY_PATH QT_QPA_FONTDIR=$dir'/fonts' $app "$@"
                                        
                                        M Offline
                                        M Offline
                                        mbnoimi
                                        wrote on last edited by
                                        #23

                                        @kshegunov I did exactly as you suggested although I didn't notice any problem in the old appname.sh file. Any way your suggestion gave me exactly same error!
                                        May you please take a look into https://github.com/mbnoimi/sql-sync-manager/releases/tag/0.12

                                        1 Reply Last reply
                                        0
                                        • kshegunovK kshegunov

                                          @mbnoimi
                                          How did any of this have anything to do with strip or .deb packages?

                                          Here: http://doc.qt.io/qt-5/linux-deployment.html#creating-the-application-package
                                          You haven't followed the required directory structure and you're executing the application from a directory different from qt.conf's location.

                                          Warning: On Linux, this function will try to get the path from the /proc file system. If that fails, it assumes that argv[0] contains the absolute file name of the executable. The function also assumes that the current directory has not been changed by the application.

                                          From here. I'd start by fixing up the shell script. You don't escape the file name of the script but instead quote the whole commands, this doesn't make much sense. Try something like this:

                                          #!/bin/sh
                                          
                                          # Don't spawn children shells unnecessarily by using `
                                          dir=$(dirname $(readlink -f "$0"))
                                          
                                          # The following might happen to be pretty important
                                          cd $dir'/bin'
                                          
                                          # Execute from the current shell's context and no need to export if you don't spawn a new shell process
                                          app=$dir'/bin/SyncAccountsManagermyapp' 
                                          
                                          LD_LIBRARY_PATH=$dir'/libs:'$LD_LIBRARY_PATH QT_QPA_FONTDIR=$dir'/fonts' $app "$@"
                                          
                                          A Offline
                                          A Offline
                                          ambershark
                                          wrote on last edited by
                                          #24

                                          @kshegunov said in Unable to deploy Qt app under Linux:

                                          @mbnoimi
                                          How did any of this have anything to do with strip or .deb packages?

                                          Here: http://doc.qt.io/qt-5/linux-deployment.html#creating-the-application-package
                                          You haven't followed the required directory structure and you're executing the application from a directory different from qt.conf's location.

                                          Warning: On Linux, this function will try to get the path from the /proc file system. If that fails, it assumes that argv[0] contains the absolute file name of the executable. The function also assumes that the current directory has not been changed by the application.

                                          From here. I'd start by fixing up the shell script. You don't escape the file name of the script but instead quote the whole commands, this doesn't make much sense. Try something like this:

                                          #!/bin/sh
                                          
                                          # Don't spawn children shells unnecessarily by using `
                                          dir=$(dirname $(readlink -f "$0"))
                                          
                                          # The following might happen to be pretty important
                                          cd $dir'/bin'
                                          
                                          # Execute from the current shell's context and no need to export if you don't spawn a new shell process
                                          app=$dir'/bin/SyncAccountsManagermyapp' 
                                          
                                          LD_LIBRARY_PATH=$dir'/libs:'$LD_LIBRARY_PATH QT_QPA_FONTDIR=$dir'/fonts' $app "$@"
                                          

                                          His problem is definitely deeper than the start script. As we've had him do it direct on the command line with the same results.

                                          Some of the other comments on the start script you made I don't understand. For instance the only difference in $() and backtick in a bash script is looks. Under the covers they both do the same thing. I go back and forth on which I use, they act the exact same though and neither starts an extra shell compared to the first. The newer syntax is $() because they look better but backtick was not deprecated or anything.

                                          The other thing is you mention has to do with escaping. If dir = /a path with spaces/mydir then the script would fail. The original script suffers from the same non-escaping though. Just not sure what your comment meant. The "$@" is a bug though, the \ shouldn't be there.

                                          Anyway back on to the problem at hand. I'm betting you might have a bad mysql lib. I would remove Qt from the equation and test a binary linked against mysql directly. See if it works. If it does I may have another idea for you, if not then fix your MySQL and you should be all set. ;)

                                          My L-GPL'd C++ Logger github.com/ambershark-mike/sharklog

                                          M kshegunovK 2 Replies Last reply
                                          1

                                          • Login

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