PDA

View Full Version : Need to compile with MySQL drivers/plugins



mongenix
6th January 2007, 17:41
I need to use Qt to develop applications to access MySQL on linux systems but I want to setup Qt on windows for now due laptop portability. I will purchase the commercial version of Qt if it works out but I can not get the MySql driver to compile.
I have tried for months (following every tutorial/instructions I could find) to compile Qt with -qt-sql-mysql but no success. Here is the last thing I tried.
I extracted the mingw-utils
I copied the reimp.exe to my MinGW\bin directory
I ran: reimp -d libmysql.lib <all ok>
I ran: dlltool -k -d libmysql.def -l libmysql.a <all ok>
I ran: configure.exe -I C:\mysql\include -L C:\mysql\lib\opt -qt-sql-mysql <all ok>
I get the message: Just run mingw32-make
I ran: mingw32-make <not ok>
It runs for quite a while and throws errors.
Here are the last several lines.
C:/Qt/4.1.1/src/sql/drivers/mysql/qsql_mysql.cpp:1113: undefined reference to `m
ysql_query@8'
./tmp\obj\debug_shared\qsql_mysql.o(.text+0x721e): In function `ZN12QMYSQLDriver
17commitTransactionEv':
C:/Qt/4.1.1/src/sql/drivers/mysql/qsql_mysql.cpp:1130: undefined reference to `m
ysql_query@8'
./tmp\obj\debug_shared\qsql_mysql.o(.text+0x73d8): In function `ZN12QMYSQLDriver
19rollbackTransactionEv':
C:/Qt/4.1.1/src/sql/drivers/mysql/qsql_mysql.cpp:1147: undefined reference to `m
ysql_query@8'
./tmp\obj\debug_shared\qsql_mysql.o(.text+0x78b2): In function `ZNK12QMYSQLDrive
r11formatValueERK9QSqlFieldb':
C:/Qt/4.1.1/src/sql/drivers/mysql/qsql_mysql.cpp:1172: undefined reference to `m
ysql_escape_string@12'
collect2: ld returned 1 exit status
mingw32-make[3]: *** [..\..\lib\QtSqld4.dll] Error 1
mingw32-make[3]: Leaving directory `C:/Qt/4.1.1/src/sql'
mingw32-make[2]: *** [debug-all] Error 2
mingw32-make[2]: Leaving directory `C:/Qt/4.1.1/src/sql'
mingw32-make[1]: *** [sub-sql-make_default-ordered] Error 2
mingw32-make[1]: Leaving directory `C:/Qt/4.1.1/src'
mingw32-make: *** [sub-src-make_default-ordered] Error 2

Suggestions?

jacek
6th January 2007, 18:35
In what directory did you place libmysql.a?

mongenix
6th January 2007, 19:41
I placed libmysql.a in C:\mysql\lib\opt

mongenix
6th January 2007, 19:45
Searching this forum, I tried following direction on a thread that were slightly different that what I originaly posted and this is the output when it errored during make.
QtSql" -I"C:/Qt/4.1.1/include" -I"C:/Mysql/include" -I"C:/mysql/include" -I"C:/Q
t/4.1.1/include/ActiveQt" -I"tmp\moc\debug_shared" -I"." -I"C:/Qt/4.1.1/mkspecs/
win32-g++" -o tmp\obj\debug_shared\qsql_mysql.o ..\..\..\sql\drivers\mysql\qsql_
mysql.cpp
g++ -mthreads -Wl,-enable-stdcall-fixup -Wl,-enable-auto-import -Wl,-enable-runt
ime-pseudo-reloc -shared -Wl,--out-implib,C:\Qt\4.1.1\plugins\sqldrivers\libqsql
mysqld.a -o "..\..\..\..\plugins\sqldrivers\qsqlmysqld.dll" tmp\obj\debug_shared
\main.o tmp\obj\debug_shared\qsql_mysql.o -L"C:\Qt\4.1.1\lib" -L"C:\Qt\4.1.1\li
b" C:\mysql\lib\opt -lmysql -lQtSqld4 -lQtCored4
C:\MinGW\bin\..\lib\gcc\mingw32\3.4.2\..\..\..\..\ mingw32\bin\ld.exe: C:\mysql\l
ib\opt: No such file: Permission denied
collect2: ld returned 1 exit status
mingw32-make[5]: *** [..\..\..\..\plugins\sqldrivers\qsqlmysqld.dll] Error 1
mingw32-make[5]: Leaving directory `C:/Qt/4.1.1/src/plugins/sqldrivers/mysql'
mingw32-make[4]: *** [debug-all] Error 2
mingw32-make[4]: Leaving directory `C:/Qt/4.1.1/src/plugins/sqldrivers/mysql'
mingw32-make[3]: *** [sub-mysql-make_default] Error 2
mingw32-make[3]: Leaving directory `C:/Qt/4.1.1/src/plugins/sqldrivers'
mingw32-make[2]: *** [sub-sqldrivers-make_default] Error 2
mingw32-make[2]: Leaving directory `C:/Qt/4.1.1/src/plugins'
mingw32-make[1]: *** [sub-plugins-make_default-ordered] Error 2
mingw32-make[1]: Leaving directory `C:/Qt/4.1.1/src'
mingw32-make: *** [sub-src-make_default-ordered] Error 2

e8johan
6th January 2007, 20:00
I just needed the QMYSQL module built for Open Source Qt + mingw. This wiki post summarizes my experiences: http://wiki.qtcentre.org/index.php?title=Building_the_QMYSQL_plugin_on_Wind ows_using_mingw .

mongenix
6th January 2007, 20:24
Thank you, That seemed to have worked.
I have not created a program to access mysql but using the Qt SQL Browser that came in the demos directory, it does query the mysql database and shows the table contents.
Now I can get started learning.

Being new, I still am not sure what all of the directions did but I guess this will come in time.