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. [SOLVED]Unable to deploy under Linux (MySQL plugin issue)
QtWS25 Last Chance

[SOLVED]Unable to deploy under Linux (MySQL plugin issue)

Scheduled Pinned Locked Moved General and Desktop
qmysqldatabasedeploymysql
16 Posts 3 Posters 7.3k Views
  • 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.
  • H Offline
    H Offline
    HPCTECH
    wrote on last edited by HPCTECH
    #1

    Hi,

    I want to deploy MySQL client under Linux as portable app. but unfortunately I get this error message although I put plugins folder in app. path (works in Windows distro):

    QSqlDatabase: QMYSQL driver not loaded
    QSqlDatabase: available drivers: QSQLITE QMYSQL QMYSQL3 QPSQL QPSQL7
    

    I checked libqsqlmysql.so from the original installation path for its dependences and found 3 errors:

    hpctech-work@hpctech-work ~/.Qt/5.5/gcc_64/plugins/sqldrivers $ ldd libqsqlmysql.so
    	linux-vdso.so.1 =>  (0x00007fff495fe000)
    	libmysqlclient_r.so.16 => not found
    	libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007fc5c4fc2000)
    	libcrypt.so.1 => /lib/x86_64-linux-gnu/libcrypt.so.1 (0x00007fc5c4d88000)
    	libnsl.so.1 => /lib/x86_64-linux-gnu/libnsl.so.1 (0x00007fc5c4b6e000)
    	libssl.so.10 => not found
    	libcrypto.so.10 => not found
    	libQt5Sql.so.5 => /home/hpctech-work/.Qt/5.5/gcc_64/plugins/sqldrivers/./../../lib/libQt5Sql.so.5 (0x00007fc5c492d000)
    	libQt5Core.so.5 => /home/hpctech-work/.Qt/5.5/gcc_64/plugins/sqldrivers/./../../lib/libQt5Core.so.5 (0x00007fc5c41e7000)
    	libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007fc5c3fc8000)
    	libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007fc5c3cc4000)
    	libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007fc5c39be000)
    	libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007fc5c37a7000)
    	libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fc5c33e2000)
    	libicui18n.so.54 => /home/hpctech-work/.Qt/5.5/gcc_64/plugins/sqldrivers/./../../lib/libicui18n.so.54 (0x00007fc5c2f73000)
    	libicuuc.so.54 => /home/hpctech-work/.Qt/5.5/gcc_64/plugins/sqldrivers/./../../lib/libicuuc.so.54 (0x00007fc5c2bc5000)
    	libicudata.so.54 => /home/hpctech-work/.Qt/5.5/gcc_64/plugins/sqldrivers/./../../lib/libicudata.so.54 (0x00007fc5c119b000)
    	libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007fc5c0f97000)
    	libgthread-2.0.so.0 => /usr/lib/x86_64-linux-gnu/libgthread-2.0.so.0 (0x00007fc5c0d94000)
    	librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007fc5c0b8c000)
    	libglib-2.0.so.0 => /lib/x86_64-linux-gnu/libglib-2.0.so.0 (0x00007fc5c0884000)
    	/lib64/ld-linux-x86-64.so.2 (0x00007fc5c5418000)
    	libpcre.so.3 => /lib/x86_64-linux-gnu/libpcre.so.3 (0x00007fc5c0645000)
    
    

    For fixing libqsqlmysql.so error I tried to re-build it as following but unfortunately I face another issue:

    hpctech-work@hpctech-work ~/.Qt/5.5/Src/qtbase/src/sql/drivers/mysql $ make
    g++ -c -pipe -I/usr/include/mysql -O2 -fno-exceptions -Wall -W -D_REENTRANT -fPIC -DQT_NO_MTDEV -DQT_NO_LIBUDEV -DQT_NO_TSLIB -DQT_NO_LIBINPUT -DQT_NO_EXCEPTIONS -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -I. -I/home/hpctech-work/.Qt/5.5/gcc_64/include -I/home/hpctech-work/.Qt/5.5/gcc_64/include/QtGui -I/home/hpctech-work/.Qt/5.5/gcc_64/include/QtCore -I.moc -I/usr/include/libdrm -I../../../../mkspecs/linux-g++ -o .obj/qsql_mysql.o qsql_mysql.cpp
    qsql_mysql.cpp:36:40: fatal error: QtSql/private/qsqldriver_p.h: No such file or directory
     #include <QtSql/private/qsqldriver_p.h>
                                            ^
    compilation terminated.
    make: *** [.obj/qsql_mysql.o] Error 1
    hpctech-work@hpctech-work ~/.Qt/5.5/Src/qtbase/src/sql/drivers/mysql $ 
    

    What do you suggest to be able to deploy my app.?

    1 Reply Last reply
    0
    • L Offline
      L Offline
      Leonardo
      wrote on last edited by
      #2

      Hi. I don't think you need to rebuild it. I think you just need to copy the missing dependencies to your executable's directory.

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

        Hi and welcome to devnet,

        Which qmake did you call to rebuild the plugin ?

        Also, depending on the distro you are targeting, shouldn't you rather make a package for it ?

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        H 1 Reply Last reply
        0
        • L Leonardo

          Hi. I don't think you need to rebuild it. I think you just need to copy the missing dependencies to your executable's directory.

          H Offline
          H Offline
          HPCTECH
          wrote on last edited by
          #4

          @Leonardo I tried to copy all the dependencies manually but unfortunately it didn't fix my issue.

          Any way, I deleted all the dependencies then called ldd as following but I still get QMYSQL driver not loaded

          ldd AndroidMysqlClient 	linux-vdso.so.1 =>  (0x00007fffbb5fe000)
          	libQt5Widgets.so.5 => /home/hpctech-work/.Qt/5.5/gcc_64/lib/libQt5Widgets.so.5 (0x00007fc849dfd000)
          	libQt5Sql.so.5 => /home/hpctech-work/.Qt/5.5/gcc_64/lib/libQt5Sql.so.5 (0x00007fc849bbc000)
          	libQt5Core.so.5 => /home/hpctech-work/.Qt/5.5/gcc_64/lib/libQt5Core.so.5 (0x00007fc849476000)
          	libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007fc849149000)
          	libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007fc848f32000)
          	libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fc848b6d000)
          	libQt5Gui.so.5 => /home/hpctech-work/.Qt/5.5/gcc_64/lib/libQt5Gui.so.5 (0x00007fc84835b000)
          	libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007fc84813c000)
          	libgobject-2.0.so.0 => /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0 (0x00007fc847eeb000)
          	libgthread-2.0.so.0 => /usr/lib/x86_64-linux-gnu/libgthread-2.0.so.0 (0x00007fc847ce9000)
          	librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007fc847ae0000)
          	libglib-2.0.so.0 => /lib/x86_64-linux-gnu/libglib-2.0.so.0 (0x00007fc8477d8000)
          	libXext.so.6 => /usr/lib/x86_64-linux-gnu/libXext.so.6 (0x00007fc8475c6000)
          	libX11.so.6 => /usr/lib/x86_64-linux-gnu/libX11.so.6 (0x00007fc847290000)
          	libGL.so.1 => /usr/lib/x86_64-linux-gnu/mesa/libGL.so.1 (0x00007fc84702a000)
          	libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007fc846d24000)
          	libicui18n.so.54 => /home/hpctech-work/.Qt/5.5/gcc_64/lib/libicui18n.so.54 (0x00007fc8468b5000)
          	libicuuc.so.54 => /home/hpctech-work/.Qt/5.5/gcc_64/lib/libicuuc.so.54 (0x00007fc846507000)
          	libicudata.so.54 => /home/hpctech-work/.Qt/5.5/gcc_64/lib/libicudata.so.54 (0x00007fc844add000)
          	libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007fc8448d8000)
          	/lib64/ld-linux-x86-64.so.2 (0x00007fc84a67e000)
          	libffi.so.6 => /usr/lib/x86_64-linux-gnu/libffi.so.6 (0x00007fc8446d0000)
          	libpcre.so.3 => /lib/x86_64-linux-gnu/libpcre.so.3 (0x00007fc844491000)
          	libxcb.so.1 => /usr/lib/x86_64-linux-gnu/libxcb.so.1 (0x00007fc844272000)
          	libglapi.so.0 => /usr/lib/x86_64-linux-gnu/libglapi.so.0 (0x00007fc84404b000)
          	libXdamage.so.1 => /usr/lib/x86_64-linux-gnu/libXdamage.so.1 (0x00007fc843e47000)
          	libXfixes.so.3 => /usr/lib/x86_64-linux-gnu/libXfixes.so.3 (0x00007fc843c41000)
          	libX11-xcb.so.1 => /usr/lib/x86_64-linux-gnu/libX11-xcb.so.1 (0x00007fc843a3f000)
          	libxcb-glx.so.0 => /usr/lib/x86_64-linux-gnu/libxcb-glx.so.0 (0x00007fc843827000)
          	libxcb-dri2.so.0 => /usr/lib/x86_64-linux-gnu/libxcb-dri2.so.0 (0x00007fc843622000)
          	libxcb-dri3.so.0 => /usr/lib/x86_64-linux-gnu/libxcb-dri3.so.0 (0x00007fc84341f000)
          	libxcb-present.so.0 => /usr/lib/x86_64-linux-gnu/libxcb-present.so.0 (0x00007fc84321b000)
          	libxcb-sync.so.1 => /usr/lib/x86_64-linux-gnu/libxcb-sync.so.1 (0x00007fc843015000)
          	libxshmfence.so.1 => /usr/lib/x86_64-linux-gnu/libxshmfence.so.1 (0x00007fc842e13000)
          	libXxf86vm.so.1 => /usr/lib/x86_64-linux-gnu/libXxf86vm.so.1 (0x00007fc842c0c000)
          	libdrm.so.2 => /usr/lib/x86_64-linux-gnu/libdrm.so.2 (0x00007fc842a00000)
          	libXau.so.6 => /usr/lib/x86_64-linux-gnu/libXau.so.6 (0x00007fc8427fb000)
          	libXdmcp.so.6 => /usr/lib/x86_64-linux-gnu/libXdmcp.so.6 (0x00007fc8425f5000)
          hpctech-work@hpctech-work ~/Snippets/C++ Qt/build-AndroidMysqlClient-Desktop_Qt_5_5_1_GCC_64bit-Debug $
          
          1 Reply Last reply
          0
          • SGaistS SGaist

            Hi and welcome to devnet,

            Which qmake did you call to rebuild the plugin ?

            Also, depending on the distro you are targeting, shouldn't you rather make a package for it ?

            H Offline
            H Offline
            HPCTECH
            wrote on last edited by
            #5

            @SGaist Thanks for reply

            Which qmake did you call to rebuild the plugin ?

            below you can find full log of my building attempt:

            hpctech-work@hpctech-work ~/.Qt/5.5/Src/qtbase/src/sql/drivers/mysql $ /home/hpctech-work/.Qt/5.5/gcc_64/bin/qmake /home/hpctech-work/.Qt/5.5/Src/qtbase/src/sql/drivers/mysql/qsql_mysql.pri
            hpctech-work@hpctech-work ~/.Qt/5.5/Src/qtbase/src/sql/drivers/mysql $ make
            g++ -c -pipe -I/usr/include/mysql -O2 -fno-exceptions -Wall -W -D_REENTRANT -fPIC -DQT_NO_MTDEV -DQT_NO_LIBUDEV -DQT_NO_TSLIB -DQT_NO_LIBINPUT -DQT_NO_EXCEPTIONS -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -I. -I/home/hpctech-work/.Qt/5.5/gcc_64/include -I/home/hpctech-work/.Qt/5.5/gcc_64/include/QtGui -I/home/hpctech-work/.Qt/5.5/gcc_64/include/QtCore -I.moc -I/usr/include/libdrm -I../../../../mkspecs/linux-g++ -o .obj/qsql_mysql.o qsql_mysql.cpp
            qsql_mysql.cpp:36:40: fatal error: QtSql/private/qsqldriver_p.h: No such file or directory
             #include <QtSql/private/qsqldriver_p.h>
                                                    ^
            compilation terminated.
            make: *** [.obj/qsql_mysql.o] Error 1
            hpctech-work@hpctech-work ~/.Qt/5.5/Src/qtbase/src/sql/drivers/mysql $ 
            
            
            H 1 Reply Last reply
            0
            • H HPCTECH

              @SGaist Thanks for reply

              Which qmake did you call to rebuild the plugin ?

              below you can find full log of my building attempt:

              hpctech-work@hpctech-work ~/.Qt/5.5/Src/qtbase/src/sql/drivers/mysql $ /home/hpctech-work/.Qt/5.5/gcc_64/bin/qmake /home/hpctech-work/.Qt/5.5/Src/qtbase/src/sql/drivers/mysql/qsql_mysql.pri
              hpctech-work@hpctech-work ~/.Qt/5.5/Src/qtbase/src/sql/drivers/mysql $ make
              g++ -c -pipe -I/usr/include/mysql -O2 -fno-exceptions -Wall -W -D_REENTRANT -fPIC -DQT_NO_MTDEV -DQT_NO_LIBUDEV -DQT_NO_TSLIB -DQT_NO_LIBINPUT -DQT_NO_EXCEPTIONS -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -I. -I/home/hpctech-work/.Qt/5.5/gcc_64/include -I/home/hpctech-work/.Qt/5.5/gcc_64/include/QtGui -I/home/hpctech-work/.Qt/5.5/gcc_64/include/QtCore -I.moc -I/usr/include/libdrm -I../../../../mkspecs/linux-g++ -o .obj/qsql_mysql.o qsql_mysql.cpp
              qsql_mysql.cpp:36:40: fatal error: QtSql/private/qsqldriver_p.h: No such file or directory
               #include <QtSql/private/qsqldriver_p.h>
                                                      ^
              compilation terminated.
              make: *** [.obj/qsql_mysql.o] Error 1
              hpctech-work@hpctech-work ~/.Qt/5.5/Src/qtbase/src/sql/drivers/mysql $ 
              
              
              H Offline
              H Offline
              HPCTECH
              wrote on last edited by HPCTECH
              #6

              Guys may I get some help.

              Depending on this doc (it seems outdated) I made another attempt to build QMySQLPlugin but unfortunately I got same result.

              hpctech-work@hpctech-work ~/.Qt/5.5/Src/qtbase/src/sql/drivers/mysql $ ~/.Qt/5.5/gcc_64/bin/qmake "INCLUDEPATH+=/usr/local/include" "LIBS+=-L/usr/local/lib -lmysqlclient_r" mysql.pro
              Cannot find file: mysql.pro.
              hpctech-work@hpctech-work ~/.Qt/5.5/Src/qtbase/src/sql/drivers/mysql $ ~/.Qt/5.5/gcc_64/bin/qmake "INCLUDEPATH+=/usr/local/include" "LIBS+=-L/usr/local/lib -lmysqlclient_r" mysql.pri
              Cannot find file: mysql.pri.
              hpctech-work@hpctech-work ~/.Qt/5.5/Src/qtbase/src/sql/drivers/mysql $ ~/.Qt/5.5/gcc_64/bin/qmake "INCLUDEPATH+=/usr/local/include" "LIBS+=-L/usr/local/lib -lmysqlclient_r" qsql_mysql.pri
              hpctech-work@hpctech-work ~/.Qt/5.5/Src/qtbase/src/sql/drivers/mysql $ make
              g++ -c -pipe -I/usr/include/mysql -O2 -fno-exceptions -Wall -W -D_REENTRANT -fPIC -DQT_NO_MTDEV -DQT_NO_LIBUDEV -DQT_NO_TSLIB -DQT_NO_LIBINPUT -DQT_NO_EXCEPTIONS -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -I. -I/usr/local/include -I/home/hpctech-work/.Qt/5.5/gcc_64/include -I/home/hpctech-work/.Qt/5.5/gcc_64/include/QtGui -I/home/hpctech-work/.Qt/5.5/gcc_64/include/QtCore -I.moc -I/usr/include/libdrm -I../../../../mkspecs/linux-g++ -o .obj/qsql_mysql.o qsql_mysql.cpp
              qsql_mysql.cpp:36:40: fatal error: QtSql/private/qsqldriver_p.h: No such file or directory
               #include <QtSql/private/qsqldriver_p.h>
                                                      ^
              compilation terminated.
              make: *** [.obj/qsql_mysql.o] Error 1
              hpctech-work@hpctech-work ~/.Qt/5.5/Src/qtbase/src/sql/drivers/mysql $ 
              
              

              BTW: I tried to fix my issue by following same steps of this post but it reached to dead end :(

              Some of my system:

              hpctech-work@hpctech-work ~ $ locate libqsqlmysql.so
              /usr/lib/x86_64-linux-gnu/qt5/plugins/sqldrivers/libqsqlmysql.so
              hpctech-work@hpctech-work ~ $ locate libmysqlclient.so
              /usr/lib/x86_64-linux-gnu/libmysqlclient.so
              /usr/lib/x86_64-linux-gnu/libmysqlclient.so.18
              /usr/lib/x86_64-linux-gnu/libmysqlclient.so.18.0.0
              hpctech-work@hpctech-work ~ $ locate libmysqlclient_r.so
              /usr/lib/x86_64-linux-gnu/libmysqlclient_r.so
              /usr/lib/x86_64-linux-gnu/libmysqlclient_r.so.18
              /usr/lib/x86_64-linux-gnu/libmysqlclient_r.so.18.0.0
              hpctech-work@hpctech-work ~ $ 
              
              
              H 1 Reply Last reply
              0
              • H HPCTECH

                Guys may I get some help.

                Depending on this doc (it seems outdated) I made another attempt to build QMySQLPlugin but unfortunately I got same result.

                hpctech-work@hpctech-work ~/.Qt/5.5/Src/qtbase/src/sql/drivers/mysql $ ~/.Qt/5.5/gcc_64/bin/qmake "INCLUDEPATH+=/usr/local/include" "LIBS+=-L/usr/local/lib -lmysqlclient_r" mysql.pro
                Cannot find file: mysql.pro.
                hpctech-work@hpctech-work ~/.Qt/5.5/Src/qtbase/src/sql/drivers/mysql $ ~/.Qt/5.5/gcc_64/bin/qmake "INCLUDEPATH+=/usr/local/include" "LIBS+=-L/usr/local/lib -lmysqlclient_r" mysql.pri
                Cannot find file: mysql.pri.
                hpctech-work@hpctech-work ~/.Qt/5.5/Src/qtbase/src/sql/drivers/mysql $ ~/.Qt/5.5/gcc_64/bin/qmake "INCLUDEPATH+=/usr/local/include" "LIBS+=-L/usr/local/lib -lmysqlclient_r" qsql_mysql.pri
                hpctech-work@hpctech-work ~/.Qt/5.5/Src/qtbase/src/sql/drivers/mysql $ make
                g++ -c -pipe -I/usr/include/mysql -O2 -fno-exceptions -Wall -W -D_REENTRANT -fPIC -DQT_NO_MTDEV -DQT_NO_LIBUDEV -DQT_NO_TSLIB -DQT_NO_LIBINPUT -DQT_NO_EXCEPTIONS -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -I. -I/usr/local/include -I/home/hpctech-work/.Qt/5.5/gcc_64/include -I/home/hpctech-work/.Qt/5.5/gcc_64/include/QtGui -I/home/hpctech-work/.Qt/5.5/gcc_64/include/QtCore -I.moc -I/usr/include/libdrm -I../../../../mkspecs/linux-g++ -o .obj/qsql_mysql.o qsql_mysql.cpp
                qsql_mysql.cpp:36:40: fatal error: QtSql/private/qsqldriver_p.h: No such file or directory
                 #include <QtSql/private/qsqldriver_p.h>
                                                        ^
                compilation terminated.
                make: *** [.obj/qsql_mysql.o] Error 1
                hpctech-work@hpctech-work ~/.Qt/5.5/Src/qtbase/src/sql/drivers/mysql $ 
                
                

                BTW: I tried to fix my issue by following same steps of this post but it reached to dead end :(

                Some of my system:

                hpctech-work@hpctech-work ~ $ locate libqsqlmysql.so
                /usr/lib/x86_64-linux-gnu/qt5/plugins/sqldrivers/libqsqlmysql.so
                hpctech-work@hpctech-work ~ $ locate libmysqlclient.so
                /usr/lib/x86_64-linux-gnu/libmysqlclient.so
                /usr/lib/x86_64-linux-gnu/libmysqlclient.so.18
                /usr/lib/x86_64-linux-gnu/libmysqlclient.so.18.0.0
                hpctech-work@hpctech-work ~ $ locate libmysqlclient_r.so
                /usr/lib/x86_64-linux-gnu/libmysqlclient_r.so
                /usr/lib/x86_64-linux-gnu/libmysqlclient_r.so.18
                /usr/lib/x86_64-linux-gnu/libmysqlclient_r.so.18.0.0
                hpctech-work@hpctech-work ~ $ 
                
                
                H Offline
                H Offline
                HPCTECH
                wrote on last edited by
                #7

                BTW, qsqldriver_p.h isn't missing but qsql_mysql.pri couldn't find it

                hpctech-work@hpctech-work ~ $ ls ~/.Qt/5.5/Src/qtbase/include/QtSql/5.5.1/QtSql/private/
                qsqlcachedresult_p.h  qsqldriver_p.h  qsql_mysql_p.h      qsql_oci_p.h   qsql_psql_p.h       qsqlresult_p.h    qsql_sqlite_p.h     qsql_tds_p.h
                qsql_db2_p.h          qsql_ibase_p.h  qsqlnulldriver_p.h  qsql_odbc_p.h  qsqlquerymodel_p.h  qsql_sqlite2_p.h  qsqltablemodel_p.h
                hpctech-work@hpctech-work ~ $ 
                
                
                1 Reply Last reply
                0
                • SGaistS Offline
                  SGaistS Offline
                  SGaist
                  Lifetime Qt Champion
                  wrote on last edited by
                  #8

                  You're in the wrong folder, it's src/plugins/sqldrivers/mysql

                  Interested in AI ? www.idiap.ch
                  Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                  H 1 Reply Last reply
                  0
                  • SGaistS SGaist

                    You're in the wrong folder, it's src/plugins/sqldrivers/mysql

                    H Offline
                    H Offline
                    HPCTECH
                    wrote on last edited by HPCTECH
                    #9

                    @SGaist said:

                    You're in the wrong folder, it's src/plugins/sqldrivers/mysql

                    Yep. I found the right path which is ~/.Qt/5.5/Src/qtbase/plugins/sqldrivers thanks @SGaist

                    Any way, my problem still exists & became much worst because it occurs too when I run my app using Qt Creator although I re-built libqsqlmysql.so successfully!

                    hpctech-work@hpctech-work ~/.Qt/5.5/Src/qtbase/src/plugins/sqldrivers/mysql $ ~/.Qt/5.5/gcc_64/bin/qmake "INCLUDEPATH+=/usr/local/include" "LIBS+=-L/usr/local/lib -lmysqlclient_r" mysql.pro
                    hpctech-work@hpctech-work ~/.Qt/5.5/Src/qtbase/src/plugins/sqldrivers/mysql $ make
                    rm -f libqsqlmysql.so
                    g++ -Wl,--no-undefined -Wl,-O1 -Wl,--enable-new-dtags -Wl,-rpath,/home/hpctech-work/.Qt/5.5/gcc_64 -Wl,-rpath,/home/hpctech-work/.Qt/5.5/gcc_64 -Wl,-rpath,/home/hpctech-work/.Qt/5.5/gcc_64/lib -shared -o libqsqlmysql.so .obj/main.o .obj/qsql_mysql.o .obj/moc_qsql_mysql_p.o  -L/usr/local/lib -rdynamic -L/usr/lib64/mysql -lmysqlclient_r -lz -lcrypt -lnsl -lm -lssl -lcrypto -L/home/hpctech-work/.Qt/5.5/gcc_64/lib -lQt5Sql -lQt5Core -lpthread  
                    mv -f libqsqlmysql.so ../../../../plugins/sqldrivers/ 
                    hpctech-work@hpctech-work ~/.Qt/5.5/Src/qtbase/src/plugins/sqldrivers/mysql $ cd ../../../../plugins/sqldrivers/
                    hpctech-work@hpctech-work ~/.Qt/5.5/Src/qtbase/plugins/sqldrivers $ cp libqsqlmysql.so /home/hpctech-work/.Qt/5.5/gcc_64/plugins/sqldrivers/
                    hpctech-work@hpctech-work ~/.Qt/5.5/Src/qtbase/plugins/sqldrivers $ ldd ~/.Qt/5.5/gcc_64/plugins/sqldrivers/libqsqlmysql.so 
                    	linux-vdso.so.1 =>  (0x00007fffcf1fe000)
                    	libmysqlclient.so.18 => /usr/lib/x86_64-linux-gnu/libmysqlclient.so.18 (0x00007fe886488000)
                    	libQt5Sql.so.5 => /home/hpctech-work/.Qt/5.5/gcc_64/lib/libQt5Sql.so.5 (0x00007fe886247000)
                    	libQt5Core.so.5 => /home/hpctech-work/.Qt/5.5/gcc_64/lib/libQt5Core.so.5 (0x00007fe885b01000)
                    	libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007fe8857fd000)
                    	libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fe885438000)
                    	libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007fe88521e000)
                    	libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007fe88501a000)
                    	libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007fe884dfc000)
                    	libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007fe884af5000)
                    	libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007fe8848df000)
                    	libicui18n.so.54 => /home/hpctech-work/.Qt/5.5/gcc_64/lib/libicui18n.so.54 (0x00007fe884471000)
                    	libicuuc.so.54 => /home/hpctech-work/.Qt/5.5/gcc_64/lib/libicuuc.so.54 (0x00007fe8840c2000)
                    	libicudata.so.54 => /home/hpctech-work/.Qt/5.5/gcc_64/lib/libicudata.so.54 (0x00007fe882698000)
                    	libgthread-2.0.so.0 => /usr/lib/x86_64-linux-gnu/libgthread-2.0.so.0 (0x00007fe882496000)
                    	librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007fe88228d000)
                    	libglib-2.0.so.0 => /lib/x86_64-linux-gnu/libglib-2.0.so.0 (0x00007fe881f85000)
                    	/lib64/ld-linux-x86-64.so.2 (0x00007fe886bfe000)
                    	libpcre.so.3 => /lib/x86_64-linux-gnu/libpcre.so.3 (0x00007fe881d46000)
                    hpctech-work@hpctech-work ~/.Qt/5.5/Src/qtbase/plugins/sqldrivers $ 
                    
                    H 1 Reply Last reply
                    0
                    • H HPCTECH

                      @SGaist said:

                      You're in the wrong folder, it's src/plugins/sqldrivers/mysql

                      Yep. I found the right path which is ~/.Qt/5.5/Src/qtbase/plugins/sqldrivers thanks @SGaist

                      Any way, my problem still exists & became much worst because it occurs too when I run my app using Qt Creator although I re-built libqsqlmysql.so successfully!

                      hpctech-work@hpctech-work ~/.Qt/5.5/Src/qtbase/src/plugins/sqldrivers/mysql $ ~/.Qt/5.5/gcc_64/bin/qmake "INCLUDEPATH+=/usr/local/include" "LIBS+=-L/usr/local/lib -lmysqlclient_r" mysql.pro
                      hpctech-work@hpctech-work ~/.Qt/5.5/Src/qtbase/src/plugins/sqldrivers/mysql $ make
                      rm -f libqsqlmysql.so
                      g++ -Wl,--no-undefined -Wl,-O1 -Wl,--enable-new-dtags -Wl,-rpath,/home/hpctech-work/.Qt/5.5/gcc_64 -Wl,-rpath,/home/hpctech-work/.Qt/5.5/gcc_64 -Wl,-rpath,/home/hpctech-work/.Qt/5.5/gcc_64/lib -shared -o libqsqlmysql.so .obj/main.o .obj/qsql_mysql.o .obj/moc_qsql_mysql_p.o  -L/usr/local/lib -rdynamic -L/usr/lib64/mysql -lmysqlclient_r -lz -lcrypt -lnsl -lm -lssl -lcrypto -L/home/hpctech-work/.Qt/5.5/gcc_64/lib -lQt5Sql -lQt5Core -lpthread  
                      mv -f libqsqlmysql.so ../../../../plugins/sqldrivers/ 
                      hpctech-work@hpctech-work ~/.Qt/5.5/Src/qtbase/src/plugins/sqldrivers/mysql $ cd ../../../../plugins/sqldrivers/
                      hpctech-work@hpctech-work ~/.Qt/5.5/Src/qtbase/plugins/sqldrivers $ cp libqsqlmysql.so /home/hpctech-work/.Qt/5.5/gcc_64/plugins/sqldrivers/
                      hpctech-work@hpctech-work ~/.Qt/5.5/Src/qtbase/plugins/sqldrivers $ ldd ~/.Qt/5.5/gcc_64/plugins/sqldrivers/libqsqlmysql.so 
                      	linux-vdso.so.1 =>  (0x00007fffcf1fe000)
                      	libmysqlclient.so.18 => /usr/lib/x86_64-linux-gnu/libmysqlclient.so.18 (0x00007fe886488000)
                      	libQt5Sql.so.5 => /home/hpctech-work/.Qt/5.5/gcc_64/lib/libQt5Sql.so.5 (0x00007fe886247000)
                      	libQt5Core.so.5 => /home/hpctech-work/.Qt/5.5/gcc_64/lib/libQt5Core.so.5 (0x00007fe885b01000)
                      	libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007fe8857fd000)
                      	libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fe885438000)
                      	libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007fe88521e000)
                      	libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007fe88501a000)
                      	libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007fe884dfc000)
                      	libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007fe884af5000)
                      	libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007fe8848df000)
                      	libicui18n.so.54 => /home/hpctech-work/.Qt/5.5/gcc_64/lib/libicui18n.so.54 (0x00007fe884471000)
                      	libicuuc.so.54 => /home/hpctech-work/.Qt/5.5/gcc_64/lib/libicuuc.so.54 (0x00007fe8840c2000)
                      	libicudata.so.54 => /home/hpctech-work/.Qt/5.5/gcc_64/lib/libicudata.so.54 (0x00007fe882698000)
                      	libgthread-2.0.so.0 => /usr/lib/x86_64-linux-gnu/libgthread-2.0.so.0 (0x00007fe882496000)
                      	librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007fe88228d000)
                      	libglib-2.0.so.0 => /lib/x86_64-linux-gnu/libglib-2.0.so.0 (0x00007fe881f85000)
                      	/lib64/ld-linux-x86-64.so.2 (0x00007fe886bfe000)
                      	libpcre.so.3 => /lib/x86_64-linux-gnu/libpcre.so.3 (0x00007fe881d46000)
                      hpctech-work@hpctech-work ~/.Qt/5.5/Src/qtbase/plugins/sqldrivers $ 
                      
                      H Offline
                      H Offline
                      HPCTECH
                      wrote on last edited by
                      #10

                      As attempting for fixing this issue. I copied sqldrivers folder to app path but it didn't fix the issue because my app & Qt Creator still show QMYSQL driver not loaded

                      hpctech-work@hpctech-work ~/Snippets/C++ Qt/build-AndroidMysqlClient-Desktop_Qt_5_5_1_GCC_64bit-Debug $ ls -Rl
                      .:
                      total 2116
                      -rwxr-xr-x 1 hpctech-work hpctech-work 667329 Oct 24 08:34 AndroidMysqlClient
                      -rw-r--r-- 1 hpctech-work hpctech-work 822872 Oct 24 08:34 dialog.o
                      -rw-r--r-- 1 hpctech-work hpctech-work 247752 Oct 24 08:34 main.o
                      -rw-r--r-- 1 hpctech-work hpctech-work  58758 Oct 24 08:34 Makefile
                      -rw-r--r-- 1 hpctech-work hpctech-work   3306 Oct 24 08:34 moc_dialog.cpp
                      -rw-r--r-- 1 hpctech-work hpctech-work 291496 Oct 24 08:34 moc_dialog.o
                      drwxr-xr-x 2 hpctech-work hpctech-work   4096 Oct 24 08:46 sqldrivers
                      -rw-r--r-- 1 hpctech-work hpctech-work   2995 Oct 24 08:34 ui_dialog.h
                      
                      ./sqldrivers:
                      total 1020
                      -rwxr-xr-x 1 hpctech-work hpctech-work 838064 Oct 13 11:14 libqsqlite.so
                      -rwxr-xr-x 1 hpctech-work hpctech-work  98222 Oct 24 08:12 libqsqlmysql.so
                      -rwxr-xr-x 1 hpctech-work hpctech-work  79248 Oct 13 11:14 libqsqlpsql.so
                      hpctech-work@hpctech-work ~/Snippets/C++ Qt/build-AndroidMysqlClient-Desktop_Qt_5_5_1_GCC_64bit-Debug $ ldd AndroidMysqlClient 
                      	linux-vdso.so.1 =>  (0x00007fff6b3fe000)
                      	libQt5Widgets.so.5 => /home/hpctech-work/.Qt/5.5/gcc_64/lib/libQt5Widgets.so.5 (0x00007f71dd56e000)
                      	libQt5Sql.so.5 => /home/hpctech-work/.Qt/5.5/gcc_64/lib/libQt5Sql.so.5 (0x00007f71dd32d000)
                      	libQt5Core.so.5 => /home/hpctech-work/.Qt/5.5/gcc_64/lib/libQt5Core.so.5 (0x00007f71dcbe7000)
                      	libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f71dc8b9000)
                      	libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f71dc6a2000)
                      	libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f71dc2dd000)
                      	libQt5Gui.so.5 => /home/hpctech-work/.Qt/5.5/gcc_64/lib/libQt5Gui.so.5 (0x00007f71dbacb000)
                      	libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f71db8ac000)
                      	libgobject-2.0.so.0 => /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0 (0x00007f71db65b000)
                      	libgthread-2.0.so.0 => /usr/lib/x86_64-linux-gnu/libgthread-2.0.so.0 (0x00007f71db459000)
                      	librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007f71db250000)
                      	libglib-2.0.so.0 => /lib/x86_64-linux-gnu/libglib-2.0.so.0 (0x00007f71daf48000)
                      	libXext.so.6 => /usr/lib/x86_64-linux-gnu/libXext.so.6 (0x00007f71dad36000)
                      	libX11.so.6 => /usr/lib/x86_64-linux-gnu/libX11.so.6 (0x00007f71daa00000)
                      	libGL.so.1 => /usr/lib/x86_64-linux-gnu/mesa/libGL.so.1 (0x00007f71da79a000)
                      	libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f71da494000)
                      	libicui18n.so.54 => /home/hpctech-work/.Qt/5.5/gcc_64/lib/libicui18n.so.54 (0x00007f71da025000)
                      	libicuuc.so.54 => /home/hpctech-work/.Qt/5.5/gcc_64/lib/libicuuc.so.54 (0x00007f71d9c77000)
                      	libicudata.so.54 => /home/hpctech-work/.Qt/5.5/gcc_64/lib/libicudata.so.54 (0x00007f71d824d000)
                      	libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f71d8048000)
                      	/lib64/ld-linux-x86-64.so.2 (0x00007f71dddef000)
                      	libffi.so.6 => /usr/lib/x86_64-linux-gnu/libffi.so.6 (0x00007f71d7e40000)
                      	libpcre.so.3 => /lib/x86_64-linux-gnu/libpcre.so.3 (0x00007f71d7c01000)
                      	libxcb.so.1 => /usr/lib/x86_64-linux-gnu/libxcb.so.1 (0x00007f71d79e2000)
                      	libglapi.so.0 => /usr/lib/x86_64-linux-gnu/libglapi.so.0 (0x00007f71d77bb000)
                      	libXdamage.so.1 => /usr/lib/x86_64-linux-gnu/libXdamage.so.1 (0x00007f71d75b7000)
                      	libXfixes.so.3 => /usr/lib/x86_64-linux-gnu/libXfixes.so.3 (0x00007f71d73b1000)
                      	libX11-xcb.so.1 => /usr/lib/x86_64-linux-gnu/libX11-xcb.so.1 (0x00007f71d71af000)
                      	libxcb-glx.so.0 => /usr/lib/x86_64-linux-gnu/libxcb-glx.so.0 (0x00007f71d6f97000)
                      	libxcb-dri2.so.0 => /usr/lib/x86_64-linux-gnu/libxcb-dri2.so.0 (0x00007f71d6d92000)
                      	libxcb-dri3.so.0 => /usr/lib/x86_64-linux-gnu/libxcb-dri3.so.0 (0x00007f71d6b8f000)
                      	libxcb-present.so.0 => /usr/lib/x86_64-linux-gnu/libxcb-present.so.0 (0x00007f71d698b000)
                      	libxcb-sync.so.1 => /usr/lib/x86_64-linux-gnu/libxcb-sync.so.1 (0x00007f71d6785000)
                      	libxshmfence.so.1 => /usr/lib/x86_64-linux-gnu/libxshmfence.so.1 (0x00007f71d6583000)
                      	libXxf86vm.so.1 => /usr/lib/x86_64-linux-gnu/libXxf86vm.so.1 (0x00007f71d637c000)
                      	libdrm.so.2 => /usr/lib/x86_64-linux-gnu/libdrm.so.2 (0x00007f71d6170000)
                      	libXau.so.6 => /usr/lib/x86_64-linux-gnu/libXau.so.6 (0x00007f71d5f6b000)
                      	libXdmcp.so.6 => /usr/lib/x86_64-linux-gnu/libXdmcp.so.6 (0x00007f71d5d65000)
                      hpctech-work@hpctech-work ~/Snippets/C++ Qt/build-AndroidMysqlClient-Desktop_Qt_5_5_1_GCC_64bit-Debug $ 
                      
                      
                      1 Reply Last reply
                      0
                      • SGaistS Offline
                        SGaistS Offline
                        SGaist
                        Lifetime Qt Champion
                        wrote on last edited by
                        #11

                        Moving the folder beside your application won't help on linux unless you modify the environment a bit so they can be found. But since you have the sql plugin built and in place, you should print the value of lastError to get more information.

                        Interested in AI ? www.idiap.ch
                        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                        H 1 Reply Last reply
                        0
                        • SGaistS SGaist

                          Moving the folder beside your application won't help on linux unless you modify the environment a bit so they can be found. But since you have the sql plugin built and in place, you should print the value of lastError to get more information.

                          H Offline
                          H Offline
                          HPCTECH
                          wrote on last edited by
                          #12

                          @SGaist

                          @SGaist said:

                          Moving the folder beside your application won't help on linux unless you modify the environment a bit so they can be found.

                          How can I do that?

                          But since you have the sql plugin built and in place, you should print the value of lastError to get more information.

                          Print out the result of lastError() but I got nothing more than I get before see the snippet please:

                          void Dialog::on_pushButton_connect_clicked()
                          {
                              QSqlDatabase db = QSqlDatabase::addDatabase("QMYSQL");
                              db.setHostName("localhost");
                              db.setDatabaseName("mysql");
                              db.setUserName("root");
                              db.setPassword("root");
                              if (!db.open()) {
                                  ui->plainTextEdit_log->setPlainText(db.lastError().text());
                                  ui->plainTextEdit_log->appendPlainText(QString("----\nPaths\n----\n%1").arg(qApp->libraryPaths().join("\n")));
                              }
                          }
                          

                          The result was:

                          Driver not loaded Driver not loaded
                          ----
                          Paths
                          ----
                          /home/hpctech-work/.Qt/5.5/gcc_64/plugins
                          /home/hpctech-work/Snippets/C++ Qt/build-AndroidMysqlClient-Desktop_Qt_5_5_1_GCC_64bit-Debug
                          
                          1 Reply Last reply
                          0
                          • SGaistS Offline
                            SGaistS Offline
                            SGaist
                            Lifetime Qt Champion
                            wrote on last edited by
                            #13

                            Can you run your application QT_DEBUG_PLUGINS set to 1 ? That should give some additional pointers as to why it doesn't load the plugin.

                            Interested in AI ? www.idiap.ch
                            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                            H 1 Reply Last reply
                            0
                            • SGaistS SGaist

                              Can you run your application QT_DEBUG_PLUGINS set to 1 ? That should give some additional pointers as to why it doesn't load the plugin.

                              H Offline
                              H Offline
                              HPCTECH
                              wrote on last edited by
                              #14

                              @SGaist said:

                              Can you run your application QT_DEBUG_PLUGINS set to 1 ? That should give some additional pointers as to why it doesn't load the plugin.

                              The result of plugin debug: https://pastebin.kde.org/ps06nig6x

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

                                You are missing the openssl libraries

                                Interested in AI ? www.idiap.ch
                                Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                                H 1 Reply Last reply
                                0
                                • SGaistS SGaist

                                  You are missing the openssl libraries

                                  H Offline
                                  H Offline
                                  HPCTECH
                                  wrote on last edited by HPCTECH
                                  #16

                                  @SGaist said:

                                  You are missing the openssl libraries

                                  It's not related to my issue because it points to "libqsqlmysql.so" which is not needed in my application (the needed one is libqsqlmysql.so)

                                  Any way, I fixed the problem (thanks to Hamish Moffatt from Qt mailing list) by removing "libqsqlmysql.so" (the old plugin original file shipped by Qt Installer) outside sqldrivers folder

                                  1 Reply Last reply
                                  0

                                  • Login

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