[SOLVED]Trying to build mysql driver in Qt 5.1.0 and MySQL 5.6
-
Hello,
It would have been nice to tell us how you solved your problem koresaram777.
Indeed, I follow every indication, download the C connector sources archives and then the C++ one, but still, I can't compile the plugin. There is no C++ file into those archive (only headers files).
I did some research but every time I have got a topic that says a different way. And I always still have those error messages:
undefined references to mysql_num_rows@4, mysql_stmt_num_rows@4, etc.
My computer is a 32bits so I only used (and download) the tools for 32bits. I say that because main of forum topic says that the problème come when using 64bits sources when the installed version of MySQL is 32bits.
If someone can help me. Thanks.
-
[quote author="Vinorcola" date="1380787942"]Hello,
It would have been nice to tell us how you solved your problem koresaram777.
Indeed, I follow every indication, download the C connector sources archives and then the C++ one, but still, I can't compile the plugin. There is no C++ file into those archive (only headers files).
I did some research but every time I have got a topic that says a different way. And I always still have those error messages:
undefined references to mysql_num_rows@4, mysql_stmt_num_rows@4, etc.
My computer is a 32bits so I only used (and download) the tools for 32bits. I say that because main of forum topic says that the problème come when using 64bits sources when the installed version of MySQL is 32bits.
If someone can help me. Thanks.[/quote]
when you download the c connector, you need to install it, after installation create the empty folder in c disk, after this just copy all you files from C:\Program Files\MySQL\Connector C++\ to your new folder, and rename this folder for example mySQL, but do it without spaces. and aflter that when you compile reference to that folder which you created before and that's all :)
-
[quote author="Vinorcola" date="1380803548"]I did what you said, but have still have the same error. Can someone help me? Or send me the compile plugin?
Thanks[/quote]
give your email and what qt version do you have?
-
Hi,
I've got some problems to compile Mysql driver, is something obvious for you ?
@cd C:\Qt\Qt5.1.1\5.1.1\Src\qtbase\src\plugins\sqldrivers\mysql
set mysql="C:\\PROGRA~1\\MySQL\\MYSQLS~1.6"
qmake "INCLUDEPATH+=%mysql%\include\" "LIBS += -L %mysql%\lib\libmysql.lib" -o Makefile mysql.pro
mingw32-make@
@g++ -Wl,-s -shared -Wl,--out-implib,C:\Qt\Qt5.1.1\5.1.1\Src\qtbase\plugins\sqldr
ivers\libqsqlmysql.a -o ........\plugins\sqldrivers\qsqlmysql.dll .obj/releas
e_shared/main.o .obj/release_shared/qsql_mysql.o .obj/release_shared/moc_qsql_my
sql_p.o -llibmysql -LC:\Qt\Qt5.1.1\5.1.1\mingw48_32\lib -lQt5Sql -lQt5Core
c:/qt/qt5.1.1/tools/mingw48_32/bin/../lib/gcc/i686-w64-mingw32/4.8.0/../../../..
/i686-w64-mingw32/bin/ld.exe: cannot find -llibmysql
collect2.exe: error: ld returned 1 exit status
Makefile.Release:80: recipe for target '........\plugins\sqldrivers\qsqlmysql
.dll' failed
mingw32-make[1]: *** [........\plugins\sqldrivers\qsqlmysql.dll] Error 1
mingw32-make[1]: Leaving directory 'C:/Qt/Qt5.1.1/5.1.1/Src/qtbase/src/plugins/s
qldrivers/mysql'
makefile:38: recipe for target 'release-all' failed
mingw32-make: *** [release-all] Error 2@ -
@ "LIBS += -L %mysql%\lib\libmysql.lib"@
That's your problem, -L is to give a path not a library name
-
Thanks for your post's!
I got an issue if I want to build my driver. I'm using qt 5.3 and mysql 5.6 (mysql-5.6.20-win32).
I added mysql.pro to qt creator and add the following two lines to the .pro file:
@
LIBS += C:/mysql/mysql-5.6.20-win32lib/libmysql.lib
INCLUDEPATH += C:/mysql/mysql-5.6.20-win32/include
@I got the following errors if i want to compile the mysql project:
C:\mysql\mysql-5.6.20-win32\include\mysql_com.h:320: error: C2146: Syntaxfehler: Fehlendes ';' vor Bezeichner 'fd'
C:\mysql\mysql-5.6.20-win32\include\mysql_com.h:320: error: C4430: Fehlender Typspezifizierer - int wird angenommen. Hinweis: "default-int" wird von C++ nicht untersttzt.
C:\mysql\mysql-5.6.20-win32\include\mysql_com.h:320: error: C2146: Syntaxfehler: Fehlendes ';' vor Bezeichner 'fd'
C:\mysql\mysql-5.6.20-win32\include\mysql_com.h:320: error: C4430: Fehlender Typspezifizierer - int wird angenommen. Hinweis: "default-int" wird von C++ nicht untersttzt.
C:\work\build\qt5\qtbase\src\sql\drivers\mysql\qsql_mysql.cpp:44: error: C1083: Datei (Include) kann nicht ge”ffnet werden: "QtSql/private/qsqldriver_p.h": No such file or directory
Many thanks for your help!
-
Hi and welcome to devnet,
Did you first build Qt 5 yourself ?
-
Hi SGaist,
yes I built qt5 by my self. I also tried to build the drivers with the following commands (see http://qt-project.org/doc/qt-4.8/sql-driver.html#how-to-build-the-qmysql-plugin-on-windows):
cd C:\work\build\qt5\qtbase\src\plugins\sqldrivers\mysql
qmake "INCLUDEPATH+=C:\mysql\mysql-5.6.20-win32\include" "LIBS+=C:\mysql\mysql-5.6.20-win32\lib\libmysql.lib" mysql.pro
mingw32-make
If I do the "mingw32-make" command I got the following errors:
C:\work\build\qt5\qtbase\src\plugins\sqldrivers\mysql>mingw32-make
mingw32-make -f Makefile.Release all
mingw32-make[1]: Entering directory 'C:/work/build/qt5/qtbase/src/plugins/sqldri
vers/mysql'
Makefile.Release:65: *** missing separator. Stop.
mingw32-make[1]: Leaving directory 'C:/work/build/qt5/qtbase/src/plugins/sqldriv
ers/mysql'
mingw32-make[1]: Leaving directory 'C:/work/build/qt5/qtbase/src/plugins/sqldriv
ers/mysql'
Makefile:40: recipe for target 'release-all' failed
mingw32-make: *** [release-all] Error 2 -
You're on windows either escape the backslashes or since you are using Qt use the unix notation i.e. forward slashes
-
I know you are, and I already wrote the options you have:
- escape the \ so in practice use \
- Since you are using Qt use /
Second option is cleaner.
-
Sorry for that stupid questions. I'm using the QT 5.4.0 64-bit for Desktop (MSVC 2013) command line.
I got the same errors if I'm setting the paths like:
qmake "INCLUDEPATH+=C:\mysql\mysql-5.6.20-win32\include" "LIBS+=C:\mysql\mysql-5.6.20-win32\lib\libmysql.lib" mysql.pro
or:
qmake "INCLUDEPATH+=C:/mysql/mysql-5.6.20-win32/include" "LIBS+=C:/mysql/mysql-5.6.20-win32/lib/libmysql.lib" mysql.pro
or does it mean that I have to set the slashes in the Makefile.Release instead of \ to /
Many thanks.
-
Ok, i was googling the problem. I get the error in the Makefile.Release in line 65:
@{......\sql\drivers\mysql}.cpp{.obj\release}.obj::
$(CXX) -c $(CXXFLAGS) $(INCPATH) -Fo.obj\release\ @<<
$<
<<@I get the error in line "<<"
I add before "<<" a tab, so "\T<<". After I fired the mingw32-make command I still got the same problem. It seems to me that the Make.Release and Make.Debug files are generated each time if I do the mingw32-make command.
Where can I set this behavior?
-
First thing to do is to delete that folder content and restart
-
I have the same problem "Makefile.Release:65: *** missing separator"
and i looked in Makefile.Release and didn't find missing separator)
There were my steps:-
create folder [tempMySQL] with include and lib folders from mysqlserver folder
It's look like this
c:\qt\qt5.3.1\tempMySQL -
open mingw console and go to "C:\Qt\Qt5.3.1\5.3\Src\qtbase\src\plugins\sqldrivers\mysql"
-
qmake "INCLUDEPATH+=C:\Qt\Qt5.3.1\tempMySQL\include" "LIBS+=C:\Qt\Qt5.3.1\tempMySQL\libmysql.lib" mysql.pro
-
mingw32-make
I didn't build Qt5.3.1 by myself, i just download
Qt 5.3.1 for Windows 32-bit (MinGW 4.8.2, OpenGL, 737 MB) (Info) from hereAnd when i worked with Qt 4.8.4 with VS2010 i didn't have a problem.
I got all those steps then i describe above and it build and worked wihout any problemAnd of course i add mingw to PATH
-
-
Is libmysql.lib the static MySQL client lib ?
-
Yes you understood it well. The thing is, on windows, static libraries and import libraries have the same extension but don't work the same. And furthermore, you can't mix mingw and MSVC libraries like that.
Look at this "wiki entry":http://www.qtcentre.org/wiki/index.php?title=Building_the_QMYSQL_plugin_on_Windows_using_MinGW
For the steps to use MinGW