Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    [SOLVED]QT5 unable to build MySQL driver under ubuntu

    Installation and Deployment
    2
    20
    16481
    Loading More Posts
    • 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 last edited by

      I want to build QMYSQL plug-in for MySQL driver under ubuntu but I got this error message:

      bq. mbnoimi-pc mysql # qmake "INCLUDEPATH+=/usr/local/include" "LIBS+=-L/usr/local/lib -lmysqlclient_r" mysql.pro
      WARNING: /opt/Qt5.0.1/5.0.1/Src/qtbase/src/plugins/sqldrivers/qsqldriverbase.pri:4: Unable to find file for inclusion qt_plugin
      Project MESSAGE: Warning: unknown QT: sql-private

      How can I fix this issue?

      PS

      I've installed libmysqlclient-dev, libmysql++-dev packages

      1 Reply Last reply Reply Quote 0
      • M
        mbnoimi last edited by

        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 Reply Quote 0
        • M
          mbnoimi last edited by

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

          1 Reply Last reply Reply Quote 0
          • A
            anubhav87 last edited by

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

            Thanks

            1 Reply Last reply Reply Quote 0
            • M
              mbnoimi last edited by

              [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 Reply Quote 0
              • A
                anubhav87 last edited by

                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 Reply Quote 0
                • M
                  mbnoimi last edited by

                  [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 Reply Quote 0
                  • A
                    anubhav87 last edited by

                    Yes I am using Qt5

                    Thanks

                    1 Reply Last reply Reply Quote 0
                    • M
                      mbnoimi last edited by

                      [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 Reply Quote 0
                      • A
                        anubhav87 last edited by

                        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 Reply Quote 0
                        • M
                          mbnoimi last edited by

                          Where you've installed Qt5 on your machine?

                          1 Reply Last reply Reply Quote 0
                          • A
                            anubhav87 last edited by

                            My Home Folder (Linux Mint 14.0)

                            Thanks

                            1 Reply Last reply Reply Quote 0
                            • A
                              anubhav87 last edited by

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

                              Thanks

                              1 Reply Last reply Reply Quote 0
                              • M
                                mbnoimi last edited by

                                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 Reply Quote 0
                                • A
                                  anubhav87 last edited by

                                  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 Reply Quote 0
                                  • M
                                    mbnoimi last edited by

                                    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 Reply Quote 0
                                    • A
                                      anubhav87 last edited by

                                      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 Reply Quote 0
                                      • M
                                        mbnoimi last edited by

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

                                        1 Reply Last reply Reply Quote 0
                                        • A
                                          anubhav87 last edited by

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

                                          Thanks

                                          1 Reply Last reply Reply Quote 0
                                          • M
                                            mbnoimi last edited by

                                            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 Reply Quote 0
                                            • First post
                                              Last post