Results 1 to 2 of 2

Thread: [solved] mingw32 with Qt 4.7.0 - QMYSQL driver not loaded

  1. #1
    Join Date
    Oct 2009
    Posts
    364
    Thanks
    10
    Thanked 37 Times in 36 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default [solved] mingw32 with Qt 4.7.0 - QMYSQL driver not loaded

    hi folks,

    I need to support an application I wrote a long time ago and was able to find the exact version of Qt I used, which is 4.7.0 (qt-sdk-win-opensource-2010.05.exe).
    After installing SDK, the sources are already in c:/qt/2010.05/qt/src
    Mingw is located at c:/qt/2010.05/mingw
    c:/mysql/lib and include are installed

    I'm currently stuck after reading the instructions from:
    https://doc.qt.io/archives/qt-4.7/sql-driver.html

    I followed the steps under 'How to build the MySQL driver for MinGW users'.
    The step regarding reimp failed as I don't have reimp.exe on my system, so I looked at the options of dlltool and it seemed to have a -z option to output a .def from the .lib.
    The subsequent configure step works, but after that mingw32-make sub-src fails with a bunch of unresolved symbols:

    mingw32-make[2]: Entering directory `C:/Qt/2010.05/qt/src/sql'
    g++ -enable-stdcall-fixup -Wl,-enable-auto-import -Wl,-enable-runtime-pseudo-reloc -mthreads -Wl -shared -Wl,--out-implib,c:\Qt\2010.05\qt\lib\libQtSqld4.a -o ..\..\lib\QtSqld4.dll object_script.QtSqld.Debug -L"c:\Qt\2010.05\qt\lib" -L"c:\Qt\2010.05\qt\lib" tmp\obj\debug_shared\QtSqld_resource_res.o -lmysql -Lc:\mysql\lib\opt -lQtCored4
    Creating library file: c:\Qt\2010.05\qt\lib\libQtSqld4.a
    ./tmp\obj\debug_shared\qsql_mysql.o: In function `codec':
    C:\Qt\2010.05\qt\src\sql/drivers/mysql/qsql_mysql.cpp:223: undefined reference to `mysql_character_set_name@4'
    ./tmp\obj\debug_shared\qsql_mysql.o: In function `qMakeError':
    C:\Qt\2010.05\qt\src\sql/drivers/mysql/qsql_mysql.cpp:234: undefined reference to `mysql_error@4'
    C:\Qt\2010.05\qt\src\sql/drivers/mysql/qsql_mysql.cpp:237: undefined reference to `mysql_errno@4'
    ./tmp\obj\debug_shared\qsql_mysql.o: In function `qMakeStmtError':
    C:\Qt\2010.05\qt\src\sql/drivers/mysql/qsql_mysql.cpp:309: undefined reference to `mysql_stmt_error@4'
    C:\Qt\2010.05\qt\src\sql/drivers/mysql/qsql_mysql.cpp:312: undefined reference to `mysql_stmt_errno@4'
    ./tmp\obj\debug_shared\qsql_mysql.o:C:\Qt\2010.05\qt \src\sql/drivers/mysql/qsql_mysql.cpp:358: undefined reference to `mysql_stmt_result_metadata@4'
    ./tmp\obj\debug_shared\qsql_mysql.o:C:\Qt\2010.05\qt \src\sql/drivers/mysql/qsql_mysql.cpp:362: undefined reference to `mysql_num_fields@4'

    <snip>

    ./tmp\obj\debug_shared\qsql_mysql.o:C:\Qt\2010.05\qt \src\sql/drivers/mysql/qsql_mysql.cpp:1507: undefined reference to `mysql_real_escape_string@16'
    collect2: ld returned 1 exit status
    mingw32-make[2]: *** [..\..\lib\QtSqld4.dll] Error 1
    mingw32-make[2]: Leaving directory `C:/Qt/2010.05/qt/src/sql'
    mingw32-make[1]: *** [debug-all] Error 2
    mingw32-make[1]: Leaving directory `C:/Qt/2010.05/qt/src/sql'
    mingw32-make: *** [sub-sql-make_default-ordered] Error 2

    I also tried the step under 'How to Build the QMYSQL Plugin on Windows' which succeeds and I end up with the following newly built files at c:/qt/2010.05/qt/plugins/sqldrivers:
    libqsqlmysql(d)4.a
    qsllmysql(d)4.dll

    I realize this is an ancient version of Qt, but it would help me a lot if I can get this going first.
    Last edited by schnitzel; 10th December 2018 at 04:02.

  2. #2
    Join Date
    Oct 2009
    Posts
    364
    Thanks
    10
    Thanked 37 Times in 36 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: [solved] mingw32 with Qt 4.7.0 - QMYSQL driver not loaded

    I have solved it by starting over from a fresh install of the SDK and then only perform the steps from How to build the QMYSQL Plugin on Windows from this page: https://doc.qt.io/archives/qt-4.7/sq...er.html#qmysql
    I then copied those libs to c:/qt/2010.05/bin/sqldrivers and the libmysql.dll to the folder with the app's exe.

    There was no need to reconfigure Qt.

Similar Threads

  1. [solved] mingw32 with Qt 4.7.0 - QMYSQL driver not loaded
    By schnitzel in forum Installation and Deployment
    Replies: 0
    Last Post: 9th December 2018, 23:29
  2. CentOS 6: QMYSQL driver not loaded, available driver: (none)
    By mp33919 in forum Installation and Deployment
    Replies: 1
    Last Post: 19th October 2016, 16:46
  3. QMYSQL driver not loaded
    By stef1570 in forum Qt Programming
    Replies: 1
    Last Post: 12th December 2011, 06:59
  4. QMYSQL driver not loaded
    By robotics in forum Qt Programming
    Replies: 3
    Last Post: 26th July 2011, 13:43
  5. QMYSQL driver not loaded
    By cydside in forum Qt Programming
    Replies: 4
    Last Post: 31st March 2010, 03:18

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.