Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Error building Qt MySQL driver, windows 10.



  • Hi all,

    Please, I need some help to build Qt MySQL driver.
    My system is Windows 10.

    Steps I've done so far:

    -I've downloaded Qt, file: qt-opensource-windows-x86-5.11.1.exe and I've installed it in folder "C:\Qt\Qt5.11.1". I Checked "MinGW 5.3.0 32 bit" only.
    -I'm able to run Qt Creator, to build and run Qt SQL projects using SQLite into a file, all is OK!

    I'm trying to build MySQL driver, based on page: https://www.seppemagiels.com/blog/create-mysql-driver-qt5-windows

    -I downloaded Qt source, file: qt-everywhere-opensource-src-5.8.0.tar.gz and extracted in folder "C:\Qt".
    -I renamed the folder "qt-everywhere-opensource-src-5.8.0" to "Sources" ("C:\Qt\Sources") for simplicity.
    -I downloaded MySQL C Connector, file: mysql-connector-c-6.1.11-win32.msi and installed it in "C:\Program Files (x86)\MySQL\MySQL Connector C 6.1", the short path is: "C:\PROGRA~2\MySQL\MYSQLC~1.1".
    -I invoked cmd "Qt 5.11.1 for Desktop (MinGW 5.3.0 32 bit)". The system PATH envirment variable has C:\Qt\Qt5.11.1\5.11.1\mingw53_32\bin; & C:/Qt/Qt5.11.1/Tools/mingw530_32\bin;

    According to the instructions, I typed:
    set mysql=C:\PROGRA~2\MySQL\MYSQLC~1.1
    cd C:\Qt\Sources\qtbase\src\plugins\sqldrivers\mysql
    qmake "INCLUDEPATH+=%mysql%\include" "LIBS+=%mysql%\lib\libmysql.lib" -o Makefile mysql.pro

    ...and I'm getting this error:
    Info: creating stash file C:\Qt\Sources\qtbase.qmake.stash
    Project ERROR: Library 'mysql' is not defined.

    There is a "QMAKE_USE += mysql" inside mysql.pro and when I commented it, I'm getting another error:
    Project ERROR: Library 'libatomic' is not defined.

    If I open mysql.pro with Qt Creator, I'm getting that I have to configure it. I click in "Configure Project" and I'm getting these messages:
    Running Windows Runtime device detection.
    No winrtrunner.exe found.
    Project ERROR: Project has no top-level .qmake.conf file.
    Error while parsing file C:\Qt\Sources\qtbase\src\plugins\sqldrivers\mysql\mysql.pro. Giving up.
    Project ERROR: Project has no top-level .qmake.conf file.
    Error while parsing file C:\Qt\Sources\qtbase\src\plugins\sqldrivers\mysql\mysql.pro. Giving up.
    Project ERROR: Project has no top-level .qmake.conf file.
    Error while parsing file C:\Qt\Sources\qtbase\src\plugins\sqldrivers\mysql\mysql.pro. Giving up.
    Cannot read /mkspecs/modules-inst/qt_plugin_qsqlmysql.pri: No such file or directory
    Project ERROR: Library 'mysql' is not defined.

    I'm getting exactly the same results in two different PCs.

    Thank'you in advance!


  • Lifetime Qt Champion

    Hi and welcome to devnet,

    These instructions are a bit outdated as the configuration system has changed a bit, see the official Qt documentation about that subject.



  • Hi, thanks for the reply!
    I tried to run configure and it needs perl!
    I'm afraid I have to setup the whole environment as it is to build Qt!
    Does anybody have the Qt MySQL driver for windows & MinGW32?
    The driver is just a .dll file isn't it?


  • Lifetime Qt Champion

    IIRC, if you start from the git clone. Why not use the archive corresponding to your Qt version ?


Log in to reply