Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
[SOLVED]Building mysql driver crashes on opengl?
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 : https://sourceforge.net/p/mingw/bugs/2024/
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.
qt 5.2.0 + latest mingw + mingw-utils 0.3 +mysql 5.6
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. qt-everywhere-opensource-src-4.6.2.zip
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, (qt-everywhere-opensource-src-4.6.2.zip), 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
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..
Then follow Qt 5's documentation "here":http://qt-project.org/doc/qt-5/sql-driver.html#how-to-build-the-qmysql-plugin-on-windows
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.
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?
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.