Important: Please read the Qt Code of Conduct -

[SOLVED]Building mysql driver crashes on opengl?

  • Hi,

    I'm following the guide "sql database drivers" from the qtcreator to build the mysqldriver.
    On the step : "mingw32-make sub-src"
    First I ran into this bug :
    Now I got stuck on the opengl.h :

    ....\include/QtGui/../../src/gui/opengl/gopengl.h:82:25 fatal error: GLES2/gl2.h: no such file or directory.

    Not sure what opengl has to do with mysql when it comes down to compiling the mysql driver.
    What now?

    qt 5.2.0 + latest mingw + mingw-utils 0.3 +mysql 5.6

  • Lifetime Qt Champion

    Hi and welcome to devnet,

    I'm not sure you are following the guide correctly. You rather seem to be building Qt rather than just the plugin

  • Steps taken :

    How to build the MySQL driver for MinGW users

    The following steps have been used successfully for WinXP SP3. In this example, Qt 4.6.2 is shown.

    Download the following components:
    Qt sources, e.g.
    Install MinGW-5.1.6.exe in, e.g. C:\MinGW.
    Extract mingw-utils-0.3.tar.gz into, e.g. C:\MinGW.
    Add the path for MinGW-5.1.6.exe to your PATH variable, e.g. C:\MinGW\bin;
    Extract the Qt sources, (, into, e.g. C:\Qt.
    Add the path for the eventual Qt binary to your PATH variable, e.g. C:\Qt\4.6.2\bin;.
    Install MySQL (mysql-5.1.35-win32.msi), customizing the components. Select only the headers and libraries. Install in, e.g. C:\MySQL\MySQL51.
    Open the DOS prompt, go to C:\MySQL\MySQL51\lib\opt, and run the following commands:
    @reimp -d libmysql.lib
    dlltool -k -d libmysql.def -l libmysql.a@
    Open the DOS prompt, go to C:\Qt\4.6.2 and run the following commands:
    @configure.exe -debug-and-release -platform win32-g++ -qt-sql-mysql -l mysql -I C:\MySQL\MySQL51\include -L C:\MySQL\MySQL51\lib\opt
    mingw32-make sub-src@
    This step takes a long time.

    The last step runs into the error.
    (Paths are a bit different, and using win7x64 but installed 32bit of everything.
    It is confusing but it is what it is..

  • Lifetime Qt Champion

  • Ah ohk that worked. Compiled and moved the dlls to app folder.
    I somehow wrongfully asumed that qtcreator fetched most up to date information for its version.

    Thanks SGaist!

  • Lifetime Qt Champion

    Nop, Qt Creator is "only" an IDE, it's qmake that knows where things are. You should rather move the dlls in your Qt sql plugins folder

  • It was build fine but does not work.
    (I will debug tonight when i'm home)

    I also read somewhere that the driver must be compiled with the same compiler as qt. Does this mean i need to compile qt too?

  • Lifetime Qt Champion

    No, only that you have to use the same compiler that was used for Qt e.g. if you downloaded the MinGW edition, use gcc that came with your Qt installation.

    Also, check that the plugin is in the right folder and that your MySQL dlls folder can be found in the PATH environment variable.

  • Thanks sir that made it a lot clearer.

Log in to reply