[SOLVED]QT5 unable to build MySQL driver under ubuntu



  • 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



  • 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



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



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



  • [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



  • 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 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



  • Yes I am using Qt5



  • [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 :)



  • 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



  • Where you've installed Qt5 on your machine?



  • My Home Folder (Linux Mint 14.0)



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



  • 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@



  • 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 $



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

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



  • 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 ~ $



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



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



  • 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”@


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.