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.
  • 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
        • A ambershark

          @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. ;)

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

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

          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. ;)

          I built recent MySQL library against Qt (from Oracle PPA) for that I made my distro using *.deb becuase it asks the user for the following depends (Debreate project file SyncAccountsManager.dbp)

          Depends: libmysqlclient20 (>=5.7.11), libstdc++6 (>=4.8.4), libgcc1 (>=1:3.0), libc6 (>=2.14)
          

          I'm not sure if this affect on the distro. Another thing I'm using recent GCC because I use some code written in recent C++ version:

          mbnoimi@mbnoimi-laptop ~ $ gcc --version
          gcc (Ubuntu 5.4.0-6ubuntu1~16.04.4) 5.4.0 20160609
          Copyright (C) 2015 Free Software Foundation, Inc.
          This is free software; see the source for copying conditions.  There is NO
          warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
          
          mbnoimi@mbnoimi-laptop ~ $
          

          Using the above gcc I built Qt MySQL Plugin but on my machine everything fine and I'm able to connect to MySQL without any problem.

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

            Guys, may I ask you for a tiny test:

            Could you please build this release then upload the binaries for me?

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

              Yea that sounds like your problem then. You used a different mysql and didn't distribute your custom one to the target system. And you should NOT do this as that would violate the license of mysql.

              I'm betting Qt is looking for a mysql version that isn't there or isn't working properly. Hence the "no driver" error message.

              Welcome to the wonderful world of making linux binaries. It is painful. It takes a lot of time and effort to solve all these problems. It sounds like you should have a good jumping off point to figure out where you went wrong with mysql though.

              You can try making sure the mysql stuff on the target machine is the same as on your machine. Use ldd liberally in trying to find what binaries are failing to load. And finally you can try something like strace to see what operations are running when it fails. OH and don't strip your binaries before distribution and try running the application through gdb. The call stack may give you insight as to why the mysql on the target machine is not good enough.

              One last idea, make sure you linked against the same bit size as the target machine. I.e. if you linked 64-bit and the target is 32-bit it would not work and have driver issues.

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

              1 Reply Last reply
              0
              • A ambershark

                @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. ;)

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

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

                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.

                You're most certainly correct. One should take my scripting "skills" with a grain of salt. What I still insist on, however, is that the application is executed from a folder that is different from the one that qt.conf resides in. This can (and possibly does) break the way the plugins are resolved (i.e. the .so locations). If you follow the documentation page on deployment you'd see that the example puts everything (app, conf file) in the root folder and the plugin directory is under that too. That's why I also referenced the warning in the docs.

                Read and abide by the Qt Code of Conduct

                1 Reply Last reply
                1
                • A Offline
                  A Offline
                  ambershark
                  wrote on last edited by ambershark
                  #29

                  @kshegunov Oh I see what you were saying. I got caught up on the scripting. ;)

                  The qt.conf is in the directory containing the executable though. So I still don't understand. It is supposed to be in bin with the executable.

                  I read that link just in case I was using qt.conf wrong all these years and I didn't see anything to say it would have a problem if launched from outside the containing directory. I may have missed it though.

                  When you launch the application like /path/to/my/app and your working directory is /home/user the binary would still get the applicationDirPath() as /path/to/my and that is where it would look for qt.conf. So as far as I can tell you don't need to cd bin before launching the app. I mean it doesn't hurt to do it, but I don't think it hurts not to do it either. :)

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

                  kshegunovK 1 Reply Last reply
                  0
                  • A Offline
                    A Offline
                    ambershark
                    wrote on last edited by
                    #30

                    Your fix_executable.sh script is bad. Here is the output from the build:

                    g++ -c -pipe -O2 -std=gnu++11 -Wall -W -D_REENTRANT -fPIC -DQT_NO_DEBUG -DQT_SQL_LIB -DQT_CORE_LIB -I. -I/usr/local/Qt/include -I/usr/local/Qt/include/QtSql -I/usr/local/Qt/include/QtCore -Itmp-lin64 -I/usr/local/Qt/mkspecs/linux-g++ -o tmp-lin64/main.o src/main.cpp
                    g++ -c -pipe -O2 -std=gnu++11 -Wall -W -D_REENTRANT -fPIC -DQT_NO_DEBUG -DQT_SQL_LIB -DQT_CORE_LIB -I. -I/usr/local/Qt/include -I/usr/local/Qt/include/QtSql -I/usr/local/Qt/include/QtCore -Itmp-lin64 -I/usr/local/Qt/mkspecs/linux-g++ -o tmp-lin64/connectdb.o src/connectdb.cpp
                    src/main.cpp: In function ‘int main(int, char**)’:
                    src/main.cpp:10:16: warning: unused variable ‘dataServer’ [-Wunused-variable]
                         ConnectDB *dataServer = new ConnectDB("QMYSQL",
                                    ^~~~~~~~~~
                    g++ -Wl,-O1 -Wl,-rpath,/usr/local/Qt/lib -o bin/SyncAccountsManager tmp-lin64/main.o tmp-lin64/connectdb.o   -L/usr/local/Qt/lib -lQt5Sql -lQt5Core -lpthread
                    /home/mike/tmp/sql-sync-manager-0.12/deb/fix_executable.sh SyncAccountsManager /usr/local/Qt /home/mike/tmp/sql-sync-manager-0.12/bin /home/mike/tmp/sql-sync-manager-0.12
                    /home/mike/tmp/sql-sync-manager-0.12/deb/fix_executable.sh: line 13: cd: /home/mike/tmp/sql-sync-manager-0.12/deb/files: No such file or directory
                    mkdir: cannot create directory ‘bin’: File exists
                    cp: cannot create regular file '/home/mike/tmp/sql-sync-manager-0.12/deb/files/bin/SyncAccountsManager': No such file or directory
                    chmod: cannot access '/home/mike/tmp/sql-sync-manager-0.12/deb/files/bin/SyncAccountsManager': No such file or directory
                    cp: cannot create regular file '/home/mike/tmp/sql-sync-manager-0.12/deb/files/SyncAccountsManager.sh': No such file or directory
                    chmod: cannot access '/home/mike/tmp/sql-sync-manager-0.12/deb/files/SyncAccountsManager.sh': No such file or directory
                    cp: cannot create regular file '/home/mike/tmp/sql-sync-manager-0.12/deb/files/bin/qt.conf': No such file or directory
                    cp: target '/home/mike/tmp/sql-sync-manager-0.12/deb/files/libs' is not a directory
                    cp: cannot create directory '/home/mike/tmp/sql-sync-manager-0.12/deb/files/libs': No such file or directory
                    make: *** [Makefile:204: bin/SyncAccountsManager] Error 1
                    

                    The fix is to make sure deb/files exists. It doesn't in your source package. Maybe add mkdir to your script or add it to the source dist.

                    Anyway, it's built, I have the same issue with unavailable driver though. But I don't have mysql installed on this machine.

                    QSqlDatabase: QMYSQL driver not loaded
                    QSqlDatabase: available drivers: QSQLITE QMYSQL QMYSQL3 QPSQL QPSQL7
                    Unable to connect!
                    ^C
                    

                    Where would you like me to send the binaries?

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

                    1 Reply Last reply
                    0
                    • A ambershark

                      @kshegunov Oh I see what you were saying. I got caught up on the scripting. ;)

                      The qt.conf is in the directory containing the executable though. So I still don't understand. It is supposed to be in bin with the executable.

                      I read that link just in case I was using qt.conf wrong all these years and I didn't see anything to say it would have a problem if launched from outside the containing directory. I may have missed it though.

                      When you launch the application like /path/to/my/app and your working directory is /home/user the binary would still get the applicationDirPath() as /path/to/my and that is where it would look for qt.conf. So as far as I can tell you don't need to cd bin before launching the app. I mean it doesn't hurt to do it, but I don't think it hurts not to do it either. :)

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

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

                      So as far as I can tell you don't need to cd bin before launching the app.

                      You don't, that was a dead end long shot on my part.

                      @mbnoimi , I get only "Unable to connect!" no missing drivers but I haven't copied your binaries for Qt and plugins I'm using my distro's (which happens to be debian) own set.

                      Read and abide by the Qt Code of Conduct

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

                        Then yours is working. If you don't get the driver issue your build worked correctly. It can't connect because you don't have the database it is looking for.

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

                        kshegunovK 1 Reply Last reply
                        0
                        • A ambershark

                          Then yours is working. If you don't get the driver issue your build worked correctly. It can't connect because you don't have the database it is looking for.

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

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

                          Then yours is working.

                          I gathered that. I don't build (and execute) code without taking a peek at what I'm building first. ;)
                          My bestest of guesses is some problem with the mysql plugin loading. As to why ... I have no idea.

                          Although ... why is libqsqlmysql.so in lib/plugins? I think it only needs to go into lib/plugins/sqldrivers and there's no reason to have a second libQt5Sql.so inside the plugins folder. These:

                          ./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)
                          

                          are also concerning.

                          On a related note, if you're deploying on debian why the hell do you want do distribute Qt too??

                          Read and abide by the Qt Code of Conduct

                          A 1 Reply Last reply
                          1
                          • kshegunovK kshegunov

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

                            Then yours is working.

                            I gathered that. I don't build (and execute) code without taking a peek at what I'm building first. ;)
                            My bestest of guesses is some problem with the mysql plugin loading. As to why ... I have no idea.

                            Although ... why is libqsqlmysql.so in lib/plugins? I think it only needs to go into lib/plugins/sqldrivers and there's no reason to have a second libQt5Sql.so inside the plugins folder. These:

                            ./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)
                            

                            are also concerning.

                            On a related note, if you're deploying on debian why the hell do you want do distribute Qt too??

                            A Offline
                            A Offline
                            ambershark
                            wrote on last edited by
                            #34

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

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

                            Then yours is working.

                            I gathered that. I don't build (and execute) code without taking a peek at what I'm building first. ;)
                            My bestest of guesses is some problem with the mysql plugin loading. As to why ... I have no idea.

                            Although ... why is libqsqlmysql.so in lib/plugins? I think it only needs to go into lib/plugins/sqldrivers and there's no reason to have a second libQt5Sql.so inside the plugins folder. These:

                            ./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)
                            

                            are also concerning.

                            On a related note, if you're deploying on debian why the hell do you want do distribute Qt too??

                            Yea I originally told him to put them in plugins/sqldrivers and when that didn't work told him to try just in plugins (the old style). Neither changed anything and I'm guessing he just left them in plugins. He should definitely move them back for a real release.

                            Those messages he gets are my big concern too. I think he has a bad install of something, be it mysql or qt or something on his target system where it isn't working. I was expecting ldd to show the problems but for some reason it's not. The problems are still there but ldd isn't shedding light on it.

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

                            kshegunovK 1 Reply Last reply
                            0
                            • A ambershark

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

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

                              Then yours is working.

                              I gathered that. I don't build (and execute) code without taking a peek at what I'm building first. ;)
                              My bestest of guesses is some problem with the mysql plugin loading. As to why ... I have no idea.

                              Although ... why is libqsqlmysql.so in lib/plugins? I think it only needs to go into lib/plugins/sqldrivers and there's no reason to have a second libQt5Sql.so inside the plugins folder. These:

                              ./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)
                              

                              are also concerning.

                              On a related note, if you're deploying on debian why the hell do you want do distribute Qt too??

                              Yea I originally told him to put them in plugins/sqldrivers and when that didn't work told him to try just in plugins (the old style). Neither changed anything and I'm guessing he just left them in plugins. He should definitely move them back for a real release.

                              Those messages he gets are my big concern too. I think he has a bad install of something, be it mysql or qt or something on his target system where it isn't working. I was expecting ldd to show the problems but for some reason it's not. The problems are still there but ldd isn't shedding light on it.

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

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

                              I think he has a bad install of something, be it mysql or qt or something on his target system where it isn't working. I

                              First ldd should be run with the proper path (for the qsqlmysql plugin). From the commands he posted he ran it with the default linker locations so it will find the distro's Qt and you he'd get version mismatches. See the lines that follow the command:

                              mbnoimivm@ubuntu:~/files/libs/plugins/sqldrivers$ ldd libqsqlmysql.so
                              ...
                                      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)
                              

                              Read and abide by the Qt Code of Conduct

                              A 1 Reply Last reply
                              0
                              • kshegunovK kshegunov

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

                                I think he has a bad install of something, be it mysql or qt or something on his target system where it isn't working. I

                                First ldd should be run with the proper path (for the qsqlmysql plugin). From the commands he posted he ran it with the default linker locations so it will find the distro's Qt and you he'd get version mismatches. See the lines that follow the command:

                                mbnoimivm@ubuntu:~/files/libs/plugins/sqldrivers$ ldd libqsqlmysql.so
                                ...
                                        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)
                                
                                A Offline
                                A Offline
                                ambershark
                                wrote on last edited by
                                #36

                                @kshegunov Yea I warned him about that and told him to run it with LD_LIBRARY_PATH before the ldd. That was like 20 posts ago though. He had similar results that didn't tell me what I needed to know though.

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

                                1 Reply Last reply
                                1
                                • M Offline
                                  M Offline
                                  mbnoimi
                                  wrote on last edited by mbnoimi
                                  #37

                                  Thank you very much @kshegunov & @ambershark

                                  I formatted my PC and the virtual machine I use for testing deployments. I don't use any PPA so I'm using the official packages of GCC and MySQL in Linux Mint 18 x64 xfce repositories.

                                  I get same exact errors I read all your posts twice to be sure everything is fine but I still unable to deploy my app. I pushed the source code to github and the deb file too.

                                  Please guide me how can I fix this issue.

                                  I'm very frustrated because I wasted hours for preparing the deployment even before writing my code. I googled a lot and read all Qt deployment guidance but nothing help me practically.

                                  M 1 Reply Last reply
                                  0
                                  • M Offline
                                    M Offline
                                    mbnoimi
                                    wrote on last edited by
                                    #38
                                    mbnoimivm@ubuntu:~$ /opt/SyncAccountsManager/SyncAccountsManager.sh
                                    QSqlDatabase: QMYSQL driver not loaded
                                    QSqlDatabase: available drivers: QSQLITE QMYSQL QMYSQL3 QPSQL QPSQL7
                                    Unable to connect!
                                    ^C
                                    mbnoimivm@ubuntu:~$
                                    
                                    1 Reply Last reply
                                    0
                                    • M Offline
                                      M Offline
                                      mbnoimi
                                      wrote on last edited by mbnoimi
                                      #39

                                      If you want to send any files, I can add you to my github project.

                                      @ambershark I added you to my project but @kshegunov I couldn't find you on Github

                                      1 Reply Last reply
                                      0
                                      • M mbnoimi

                                        Thank you very much @kshegunov & @ambershark

                                        I formatted my PC and the virtual machine I use for testing deployments. I don't use any PPA so I'm using the official packages of GCC and MySQL in Linux Mint 18 x64 xfce repositories.

                                        I get same exact errors I read all your posts twice to be sure everything is fine but I still unable to deploy my app. I pushed the source code to github and the deb file too.

                                        Please guide me how can I fix this issue.

                                        I'm very frustrated because I wasted hours for preparing the deployment even before writing my code. I googled a lot and read all Qt deployment guidance but nothing help me practically.

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

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

                                        I formatted my PC and the virtual machine I use for testing deployments

                                        I tried to run the app on Mint VM and it works fine! so the problem in my Ubuntu VM. I'm using Ubuntu 14.04 while I build the app under LM 18 (built from Ubuntu 16.04) so I've to investigate in Ubuntu libraries.

                                        As I told you before deb package calls the following dependencies

                                        Depends: libmysqlclient20 (>=5.7.11), libstdc++6 (>=4.8.4), libgcc1 (>=1:3.0), libc6 (>=2.14)
                                        

                                        Do you think I've to change them for previous Ubuntu versions?

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

                                          Oh yeah... Problem SOLVED at last

                                          The problem occurs because of different versions of libstdc++6 I fixed it by modifying the dependency from 4.8.4 to 5.4.0

                                          Ubuntu 14.04 and earlier users need to add the following PPA then Qt 5.7 apps will run smoothly:

                                          sudo add-apt-repository ppa:ubuntu-toolchain-r/test 
                                          sudo apt-get update
                                          
                                          kshegunovK A 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