davethomaspilot
4th January 2014, 16:27
I built Qt5.2 successfully and have been using it. Now I want the mysql driver.
Followed the instructions here:
http://qt-project.org/doc/qt-5.0/qtsql/sql-driver.html
specifically:
cd %QTDIR%\src\plugins\sqldrivers\mysql
qmake "INCLUDEPATH+=C:/MySQL/include" "LIBS+=C:/MYSQL/MySQL Server <version>/lib/opt/libmysql.lib" mysql.pro
nmake
If you are not usin...
And changed the INCLUDEPATH and LIBS for my mysql installation.
It seems like everything compiles, but the link step is failing:
cl -c -nologo -Zm200 -Zc:wchar_t -Zi -MDd -GR -W3 -w34100 -w34189 -DUNICODE -DWIN32 -DQT_NO_CAST_TO_ASCII -DQT_N
O_CAST_FROM_ASCII -DQT_NO_EXCEPTIONS -DQT_PLUGIN -DQT_SQL_LIB -DQT_CORE_LIB -I"C:\Progra~1\MySQL\MySQLs~1.6\include" -I"
..\..\..\..\include\QtSql\5.2.0" -I"..\..\..\..\include\QtSql\5.2.0\QtSql" -I"..\..\..\..\include" -I"..\..\..\..\includ
e\QtSql" -I"..\..\..\..\include\QtCore\5.2.0" -I"..\..\..\..\include\QtCore\5.2.0\QtCore" -I"..\..\..\..\include\QtCore"
-I".moc\debug" -I"..\..\..\..\mkspecs\win32-msvc2010" -Fo.obj\debug\ @C:\Users\Dave\AppData\Local\Temp\nm4F2.tmp
moc_qsql_mysql_p.cpp
echo 2 /* CREATEPROCESS_MANIFEST_RESOURCE_ID */ 24 /* RT_MANIFEST */ "..\\..\\..\\..\\plugins\\sqldrivers\\qsqlm
ysqld.dll.embed.manifest">..\..\..\..\plugins\sqldrivers\qsqlmysqld.dll_mani fest.rc
if not exist ..\..\..\..\plugins\sqldrivers\qsqlmysqld.dll if exist ..\..\..\..\plugins\sqldrivers\qsqlmysqld.dl
l.embed.manifest del ..\..\..\..\plugins\sqldrivers\qsqlmysqld.dll.embe d.manifest
if exist ..\..\..\..\plugins\sqldrivers\qsqlmysqld.dll.embe d.manifest copy /Y ..\..\..\..\plugins\sqldrivers\qsq
lmysqld.dll.embed.manifest ..\..\..\..\plugins\sqldrivers\qsqlmysqld.dll_mani fest.bak
link /NOLOGO /DYNAMICBASE /NXCOMPAT /DEBUG /DLL /MANIFEST /MANIFESTFILE:..\..\..\..\plugins\sqldrivers\qsqlmy sql
d.dll.embed.manifest /OUT:..\..\..\..\plugins\sqldrivers\qsqlmysqld.dll @C:\Users\Dave\AppData\Local\Temp\nm9B3.tmp
LINK : fatal error LNK1104: cannot open file 'C:\Program.obj'
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\BIN\link.EXE"' : return code '0x450'
Stop.
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\BIN\nmake.exe"' : return code '0x2'
Stop.
I took a look at the makefile. There is an OBJECTS_DIR target that might be confusing things:
####### Output directory
OBJECTS_DIR = .obj\debug
All the objs are going into a directory .....src/plugins/sqldriver/mysql/.obj/debug and .....src/plugins/sqldriver/mysql/.obj/release
Maybe they were supposed to go to .....src/plugins/sqldriver/mysql/obj/debug and .....src/plugins/sqldriver/mysql/obj/release?
In other words "current working directory/obj" versus "current working directory/.obj".
Maybe an nmake versus make difference in how the .obj\debug is interepreted?
Dave THomas
Added after 7 minutes:
Hacked the makefile to add quotes around the Mysql lib directory (since it had spaces). Fixed, still have unresolved references, working that now.
Added after 1 21 minutes:
Can't figure out how to get rid of the unresolved externals.
My (very recent) mysql default install doesn't have a C:\MySQL\lib\opt. But, there's both a libmysql.lib and libmysql.dll in :
C:\Program Files\MySQL\MySQL Server 5.6\lib
So, here's my qmake invocation:
qmake "INCLUDEPATH+= c:/Progra~1/MySql/Mysqls~1.6/include" "LIBS+=C:\Progra~1\MySQL\MySQLs~1.6\lib\libmysql.li b" mysql.pro
(there's also a mysqlclient.lib there)
I have
C:\Program Files\MySQL\MySQL Server 5.6\lib in my path. I also tried copying C:\Program Files\MySQL\MySQL Server 5.6\lib\libmysql.dll[/QUOTE] to the
E:\opencv_2.4.7\dep\qt-everywhere-opensource-src-5.2.0\qtbase\src\plugins\sqldrivers\mysql--that didn't help either.
Also tried forward slashes everywhere in the qmake. Didn't change anything.
Lots of unresolved externals like this:
qsql_mysql.obj : error LNK2019: unresolved external symbol _mysql_fetch_field@4 referenced in function "public: bool __t
hiscall QMYSQLResultPrivate::bindInValues(void)" (?bindInValues@QMYSQLResultPrivate@@QAE_NXZ)
qsql_mysql.obj : error LNK2019: unresolved external symbol _mysql_num_fields@4 referenced in function "public: bool __th
iscall QMYSQLResultPrivate::bindInValues(void)" (?bindInValues@QMYSQLResultPrivate@@QAE_NXZ)
How can I tell if the symbols aren't in the lib, or if the dll isn't being found?
Thanks,
Dave Thomas
Followed the instructions here:
http://qt-project.org/doc/qt-5.0/qtsql/sql-driver.html
specifically:
cd %QTDIR%\src\plugins\sqldrivers\mysql
qmake "INCLUDEPATH+=C:/MySQL/include" "LIBS+=C:/MYSQL/MySQL Server <version>/lib/opt/libmysql.lib" mysql.pro
nmake
If you are not usin...
And changed the INCLUDEPATH and LIBS for my mysql installation.
It seems like everything compiles, but the link step is failing:
cl -c -nologo -Zm200 -Zc:wchar_t -Zi -MDd -GR -W3 -w34100 -w34189 -DUNICODE -DWIN32 -DQT_NO_CAST_TO_ASCII -DQT_N
O_CAST_FROM_ASCII -DQT_NO_EXCEPTIONS -DQT_PLUGIN -DQT_SQL_LIB -DQT_CORE_LIB -I"C:\Progra~1\MySQL\MySQLs~1.6\include" -I"
..\..\..\..\include\QtSql\5.2.0" -I"..\..\..\..\include\QtSql\5.2.0\QtSql" -I"..\..\..\..\include" -I"..\..\..\..\includ
e\QtSql" -I"..\..\..\..\include\QtCore\5.2.0" -I"..\..\..\..\include\QtCore\5.2.0\QtCore" -I"..\..\..\..\include\QtCore"
-I".moc\debug" -I"..\..\..\..\mkspecs\win32-msvc2010" -Fo.obj\debug\ @C:\Users\Dave\AppData\Local\Temp\nm4F2.tmp
moc_qsql_mysql_p.cpp
echo 2 /* CREATEPROCESS_MANIFEST_RESOURCE_ID */ 24 /* RT_MANIFEST */ "..\\..\\..\\..\\plugins\\sqldrivers\\qsqlm
ysqld.dll.embed.manifest">..\..\..\..\plugins\sqldrivers\qsqlmysqld.dll_mani fest.rc
if not exist ..\..\..\..\plugins\sqldrivers\qsqlmysqld.dll if exist ..\..\..\..\plugins\sqldrivers\qsqlmysqld.dl
l.embed.manifest del ..\..\..\..\plugins\sqldrivers\qsqlmysqld.dll.embe d.manifest
if exist ..\..\..\..\plugins\sqldrivers\qsqlmysqld.dll.embe d.manifest copy /Y ..\..\..\..\plugins\sqldrivers\qsq
lmysqld.dll.embed.manifest ..\..\..\..\plugins\sqldrivers\qsqlmysqld.dll_mani fest.bak
link /NOLOGO /DYNAMICBASE /NXCOMPAT /DEBUG /DLL /MANIFEST /MANIFESTFILE:..\..\..\..\plugins\sqldrivers\qsqlmy sql
d.dll.embed.manifest /OUT:..\..\..\..\plugins\sqldrivers\qsqlmysqld.dll @C:\Users\Dave\AppData\Local\Temp\nm9B3.tmp
LINK : fatal error LNK1104: cannot open file 'C:\Program.obj'
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\BIN\link.EXE"' : return code '0x450'
Stop.
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\BIN\nmake.exe"' : return code '0x2'
Stop.
I took a look at the makefile. There is an OBJECTS_DIR target that might be confusing things:
####### Output directory
OBJECTS_DIR = .obj\debug
All the objs are going into a directory .....src/plugins/sqldriver/mysql/.obj/debug and .....src/plugins/sqldriver/mysql/.obj/release
Maybe they were supposed to go to .....src/plugins/sqldriver/mysql/obj/debug and .....src/plugins/sqldriver/mysql/obj/release?
In other words "current working directory/obj" versus "current working directory/.obj".
Maybe an nmake versus make difference in how the .obj\debug is interepreted?
Dave THomas
Added after 7 minutes:
Hacked the makefile to add quotes around the Mysql lib directory (since it had spaces). Fixed, still have unresolved references, working that now.
Added after 1 21 minutes:
Can't figure out how to get rid of the unresolved externals.
My (very recent) mysql default install doesn't have a C:\MySQL\lib\opt. But, there's both a libmysql.lib and libmysql.dll in :
C:\Program Files\MySQL\MySQL Server 5.6\lib
So, here's my qmake invocation:
qmake "INCLUDEPATH+= c:/Progra~1/MySql/Mysqls~1.6/include" "LIBS+=C:\Progra~1\MySQL\MySQLs~1.6\lib\libmysql.li b" mysql.pro
(there's also a mysqlclient.lib there)
I have
C:\Program Files\MySQL\MySQL Server 5.6\lib in my path. I also tried copying C:\Program Files\MySQL\MySQL Server 5.6\lib\libmysql.dll[/QUOTE] to the
E:\opencv_2.4.7\dep\qt-everywhere-opensource-src-5.2.0\qtbase\src\plugins\sqldrivers\mysql--that didn't help either.
Also tried forward slashes everywhere in the qmake. Didn't change anything.
Lots of unresolved externals like this:
qsql_mysql.obj : error LNK2019: unresolved external symbol _mysql_fetch_field@4 referenced in function "public: bool __t
hiscall QMYSQLResultPrivate::bindInValues(void)" (?bindInValues@QMYSQLResultPrivate@@QAE_NXZ)
qsql_mysql.obj : error LNK2019: unresolved external symbol _mysql_num_fields@4 referenced in function "public: bool __th
iscall QMYSQLResultPrivate::bindInValues(void)" (?bindInValues@QMYSQLResultPrivate@@QAE_NXZ)
How can I tell if the symbols aren't in the lib, or if the dll isn't being found?
Thanks,
Dave Thomas