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

Building plugins with MSVC [mysql-driver]



  • Hi,

    I am having trouble building the mysql-driver-plugin on my windows desktop.
    I know there are already like a hundred threads here and probably thousands more in other forums concering this topic and I've probably worked through the majority of them, but i cannot get it to work.
    I have successfully build the driver on my linux system, however I cannot replicate that on my windows machine.

    My Setup:

    1. I have downloaded Microsoft Visual Studio 2019 (not sure if that was necessary)
    2. I have downloaded both the binaries and the source code of version 5.15.2 via the online installer

    From my understanding I need to use the Qt-Console, switch to the folder .../qtbase/src/plugins/sqldrivers/ and run qmake and pass the paths to the include and lib-folder of the mysql-library which I have downloaded myself.
    But when I run qmake in the Qt-Console there is not output, no hints, no error-messages..
    I feel like there was some output in linux which said which drivers were enabled for build - here is see nothing.

    I am kind of stuck and don't know what else I could try.

    Thanks in advance for your time and hints,
    Unzu


  • Lifetime Qt Champion

    @unzu said in Building plugins with MSVC [mysql-driver]:

    But when I run qmake in the Qt-Console there is not output, no hints, no error-messages..

    Please read the doc, correctly call qmake and show us the output.
    Or better: drop MySQLand use PostgreSQL - this plugin is provided by the Qt installer.



  • Ok, thats what I get:

    C:\Qt\5.15.2\Src\qtbase\src\plugins\sqldrivers>qmake -version
    QMake version 3.1
    Using Qt version 5.15.2 in C:/Qt/5.15.2/msvc2019_64/lib
    
    C:\Qt\5.15.2\Src\qtbase\src\plugins\sqldrivers>qmake -- MYSQL_INCDIR="C:/MYSQL/include" MYSQL_LIBDIR="C:/MYSQL/lib"
    Project ERROR: You cannot configure sqldrivers separately within a top-level build.
    

    So at least I am getting some feedback now.
    Right now I am trying to figure out what it means with the top-level-build-thingy.

    Unzu



  • @unzu You have to use mysql connector https://downloads.mysql.com/archives/get/p/19/file/mysql-connector-c-6.1.11-winx64.zip then:

    call "C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Auxiliary/Build/vcvars64.bat"
    cd qtbase/src/plugins/sqldrivers
    qmake -- MYSQL_INCDIR="\path\of\mysql-connector-c-6.1.11-winx64\include" MYSQL_LIBDIR="\path\of\mysql-connector-c-6.1.11-winx64\lib"
    nmake sub-mysql
    nmake install
    

    I have a Github Actions that produces the plugin: https://github.com/eyllanesc/stackoverflow/blob/master/.github/workflows/mysql_plugin.yml#L36


  • Lifetime Qt Champion

    @unzu said in Building plugins with MSVC [mysql-driver]:

    Project ERROR: You cannot configure sqldrivers separately within a top-level build.

    This looks like you run configure.bat already in the base source dir. Start over with a clean source dir.



  • @Christian-Ehrlicher said in Building plugins with MSVC [mysql-driver]:

    This looks like you run configure.bat already in the base source dir. Start over with a clean source dir.

    Yes, I just did that.
    That was the issue - I ran the configure script in the base source directory prior to this.
    After re-downloading the entire sources I was able to build the driver.

    Thanks!


Log in to reply