How to build Mysql driver with QT static build

  • I tried to make a qt static version with MySQL build option so I used this to configure


    it gives me an error and the MySQL in the summary file it marked by no so it's not working yet so I used this


    for both, i got this error

    ERROR: Feature 'sql-mysql' was enabled, but the pre-condition 'libs.mysql' failed.

    so I tried this one


    i got this error

    ERROR: Invalid value given for boolean command line option 'sql-mysql'.

    so what command should i use to enable mysql to be built with my static version
    Thanks in advance

  • i have the same problem, the only solution that i found was that i use qt 5.7.1 instead a higher version and then it was working. maybe it works with higher version but i tried a few weeks and then i give up.

  • hope that anyone tried this with a higher version to share this iam using QT 5.10 and I did not try the build static version before this

  • when I was checking my question, by Coincidence I found the pinned post of How to create the plugin of MYSQL for Qt I check it and I follow some of his steps
    i downloaded the MySQL community server and put it on C drive and rename the folder
    that's all then in my configure command I add this to the end of my command

    -sql-myself -I "C:\MySQL\include" -L "C:\MySQL\lib"

    then I found in the summary folder that myself is marked by yes so I started built it then I test a simple MySQL connection with my static build it worked but I should include the .dll folder if not the app crashes I don't know if it's the right way to do this as I add .dll because the goal of the static build is to not use the DLL files it's only standalone app

  • Lifetime Qt Champion

    Then you have to also use static libraries for all the dependencies you want to use.

Log in to reply

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