Results 1 to 2 of 2

Thread: Mysql Driver build Issue

  1. #1
    Join Date
    Jun 2012
    Posts
    219
    Thanks
    28
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Mysql Driver build Issue

    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\sqld rivers\qsqlmysqld.dll_manifest.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.l ib" 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
    Last edited by davethomaspilot; 4th January 2014 at 17:27.

  2. #2
    Join Date
    Jun 2012
    Posts
    219
    Thanks
    28
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Mysql Driver build Issue

    The problem was that I had installed 64 bit mysql, not 32.

    It's easy to do. The web page makes it sound like you get anything you want from the installer, but I couldn't figure out how to get 32 bit windows version. Maybe it's because I previously installed 64 bit version, but I uninstalled that both with their installer tool and with Windows control panel. The option to install 32 bit was always disabled.

    Builds fine now, with 32 bit mysql installed. Haven't tried running yet though.

Similar Threads

  1. MySQL driver issue
    By Momergil in forum Qt Programming
    Replies: 4
    Last Post: 3rd March 2012, 08:42
  2. source code for odbc driver or MySql driver in arm-embedded-linux
    By sattu in forum Qt for Embedded and Mobile
    Replies: 0
    Last Post: 24th January 2011, 11:11
  3. I need MySQL driver for Qt 4.6, WindowsXP(32), MySQL 5.1
    By User_3 in forum Installation and Deployment
    Replies: 7
    Last Post: 15th October 2010, 16:19
  4. [QT 4.6] Error build driver mysql
    By vinny gracindo in forum Installation and Deployment
    Replies: 1
    Last Post: 26th February 2010, 02:02
  5. Build MySql driver in Windows Vista
    By Raccoon29 in forum Qt Programming
    Replies: 6
    Last Post: 11th January 2010, 14:01

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.