Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. [SOLVED]QT5 unable to build MySQL driver under ubuntu

[SOLVED]QT5 unable to build MySQL driver under ubuntu

Scheduled Pinned Locked Moved Installation and Deployment
20 Posts 2 Posters 17.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.
  • M Offline
    M Offline
    mbnoimi
    wrote on last edited by
    #2

    I believe this is matter of error paths I tried to use the following but it didn't work:

    bq. qmake "INCLUDEPATH+=/usr/include/mysql" "LIBS+=-L/usr/lib/x86_64-linux-gnu -lmysqlclient_r" mysql.pro

    PS

    I forgot to tell you that I'm using ubuntu 12.10 x64

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

      The solution of this issue is by calling qmake as absolute path because it was using Qt4's qmake.

      1 Reply Last reply
      0
      • A Offline
        A Offline
        anubhav87
        wrote on last edited by
        #4

        very very new to the forum sites :)
        what is mysql.pro here please tell

        Thanks

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

          [quote author="anubhav87" date="1371193722"]very very new to the forum sites :)
          what is mysql.pro here please tell[/quote]

          Project file of Qt MySQL plugin

          1 Reply Last reply
          0
          • A Offline
            A Offline
            anubhav87
            wrote on last edited by
            #6

            I have mysql installed
            when i run mysql --version
            i get
            mysql Ver 14.14 Distrib 5.5.29, for debian-linux-gnu (x86_64) using readline 6.2
            But When i try to connect MySql With Qt uisng QSqldatabase it give the error below

            QSqlDatabase: QMYSQL driver not loaded
            QSqlDatabase: available drivers: QSQLITE

            From where to start now can you tell me

            Thanks

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

              [quote author="anubhav87" date="1371195516"]I have mysql installed
              when i run mysql --version
              i get
              mysql Ver 14.14 Distrib 5.5.29, for debian-linux-gnu (x86_64) using readline 6.2
              But When i try to connect MySql With Qt uisng QSqldatabase it give the error below

              QSqlDatabase: QMYSQL driver not loaded
              QSqlDatabase: available drivers: QSQLITE

              From where to start now can you tell me [/quote]

              The system show you that you havn't Qt plugin for MySQL (you have SQLite) so try to build your own Qt MySQL plugin from https://qt-project.org/doc/qt-5.0/qtsql/sql-driver.html#qmysql

              PS
              I suppose you're using Qt5

              1 Reply Last reply
              0
              • A Offline
                A Offline
                anubhav87
                wrote on last edited by
                #8

                Yes I am using Qt5

                Thanks

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

                  [quote author="anubhav87" date="1371196499"]Yes I am using Qt5[/quote]

                  Try to use the mentioned steps above and don't forget to read documentation page I've linked it to you :)

                  1 Reply Last reply
                  0
                  • A Offline
                    A Offline
                    anubhav87
                    wrote on last edited by
                    #10

                    Hi,
                    I am running below mentioned command

                    qmake "INCLUDEPATH+=/usr/local/include" "LIBS+=-L/usr/local/lib -lmysqlclient_r" mysql.pro
                    make

                    but it is saying
                    Cannot find file: mysql.pro

                    where will i get mysql.pro

                    Thanks

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

                      Where you've installed Qt5 on your machine?

                      1 Reply Last reply
                      0
                      • A Offline
                        A Offline
                        anubhav87
                        wrote on last edited by
                        #12

                        My Home Folder (Linux Mint 14.0)

                        Thanks

                        1 Reply Last reply
                        0
                        • A Offline
                          A Offline
                          anubhav87
                          wrote on last edited by
                          #13

                          But i am still struggling with mysql.pro file where is this

                          Thanks

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

                            OK, try to do the following (considering installation directory is /home/usename/Qt5.0.2):

                            @usename@usename-pc ~ $ sudo apt-get install tasksel
                            usename@usename-pc ~ $ sudo tasksel install LAMP
                            usename@usename-pc ~ $ sudo tasksel install libmysqlclient-dev
                            usename@usename-pc ~ $ cd /home/usename/Qt5.0.2/5.0.2/Src/qtbase/src/plugins/sqldrivers/mysql
                            usename@usename-pc ~ $ /home/usename/Qt5.0.2/5.0.2/gcc_64/bin/qmake "INCLUDEPATH+=/usr/include/mysql" "LIBS+=-L/usr/lib/x86_64-linux-gnu -lmysqlclient_r" mysql.pro
                            usename@usename-pc ~ $ make
                            usename@usename-pc ~ $ make install@

                            1 Reply Last reply
                            0
                            • A Offline
                              A Offline
                              anubhav87
                              wrote on last edited by
                              #15

                              As you said i did that too but again where is this mysql.pro

                              my output as you said

                              username@username ~ $ sudo tasksel
                              [sudo] password for username:
                              sudo: tasksel: command not found
                              username@username ~ $ cd Qt5.0.0/5.0.0/
                              username@username ~/Qt5.0.0/5.0.0 $ cd gcc_64/
                              username@username ~/Qt5.0.0/5.0.0/gcc_64 $ cd plugins/
                              username@username ~/Qt5.0.0/5.0.0/gcc_64/plugins $ cd sqldrivers/
                              username@username ~/Qt5.0.0/5.0.0/gcc_64/plugins/sqldrivers $ /home/username/Q
                              Qt5.0.0/ QT_APP/
                              username@username ~/Qt5.0.0/5.0.0/gcc_64/plugins/sqldrivers $ /home/username/Qt5.0.0/5.0.0/gcc_64/bin/qm
                              qmake qmlmin qmlscene
                              qml1plugindump qmlplugindump qmltestrunner
                              qmlbundle qmlprofiler qmlviewer
                              username@username ~/Qt5.0.0/5.0.0/gcc_64/plugins/sqldrivers $ /home/username/Qt5.0.0/5.0.0/gcc_64/bin/qmake "INCLUDEPATH+=/usr/include/mysql" "LIBS+=-L/usr/lib/x86_64-linux-gnu

                              ^C
                              username@username ~/Qt5.0.0/5.0.0/gcc_64/plugins/sqldrivers $ /home/username/Qt5.0.0/5.0.0/gcc_64/bin/qmake "INCLUDEPATH+=/usr/include/mysql" "LIBS+=-L/usr/lib/x86_64-linux-gnu -lmysqlclient_r" mysql.pro
                              Cannot find file: mysql.pro.
                              username@username ~/Qt5.0.0/5.0.0/gcc_64/plugins/sqldrivers $

                              Thanks

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

                                First of all, Could you please put the log inside code format.

                                give me the output of the following:
                                @cd ~
                                find ./ -name "mysql.pro"@

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

                                  I find query.txt located on my desktop it gives the correct location but for mysql.pro it return nothing

                                  username@username ~ $ find ./ -name "query.txt"
                                  ./Desktop/query.txt
                                  username@username ~ $ find ./ -name "mysql.pro"
                                  username@username ~ $

                                  Thanks

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

                                    It seems that you didn't install Qt into your home directory. Try to run find where Qt installed.

                                    1 Reply Last reply
                                    0
                                    • A Offline
                                      A Offline
                                      anubhav87
                                      wrote on last edited by
                                      #19

                                      Below is the path where i have installed my qt
                                      /home/myusername/Qt5.0.0

                                      Thanks

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

                                        Try to download recent Qt installer (currently 5.0.2) , through installation wizard choose all available components (it has Qt' source code). Then:

                                        @cd ~
                                        find ./ -name “mysql.pro”@

                                        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