Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. How to install MySql driver plugin in QT SDK 4.7 (2010.05)?
Forum Updated to NodeBB v4.3 + New Features

How to install MySql driver plugin in QT SDK 4.7 (2010.05)?

Scheduled Pinned Locked Moved Installation and Deployment
17 Posts 7 Posters 21.9k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    blueyes
    wrote on last edited by
    #1

    Hello,

    Building QT 4.7 with MySql plugin under WINDOWS XP doesn't work!
    I spent two days and no results so far.
    I reckon there is a bug somewhere which needs to be fixed.
    I followed many different procedures looking at almost all the forums but I could not succeed!

    http://www.qtcentre.org/threads/26245-Qt-4.6-api\qscriptextensionplugin.h(43)-Error-Undefined-interface

    http://christopher.rasch-olsen.no/2009/04/14/qt-45-and-mysql-plugin-with-mingw-on-windows-xp/

    http://www.pikopong.com/blog/2010/04/11/how-to-enable-mysql-support-in-qt-sdk-for-windows/

    http://ga.maral.me/post/1705473515/building-and-deploying-qmysql-on-windows-with-mingw

    And so forth...

    I could succeed with QT 2010.02 but not with the last version. Is there any FIX for that????

    1 Reply Last reply
    0
    • D Offline
      D Offline
      DenisKormalev
      wrote on last edited by
      #2

      Can you be more specific with problems?

      1 Reply Last reply
      0
      • B Offline
        B Offline
        blueyes
        wrote on last edited by
        #3

        Sure.

        First of all: "Look at this link":http://christopher.rasch-olsen.no/2009/04/14/qt-45-and-mysql-plugin-with-mingw-on-windows-xp/
        When I followed these instructions on my laptop (WINDOWS VISTA HOME PREMIUM) at home everything worked fine using QT 2010.02 SDK version installed (a few months ago).
        Then at work, I downloaded the last available version QT 2010.05, installed on my desktop PC (WINDOWS XP) and tried to repeat exactly the same steps but unsuccessfully.
        Downloaded mingw-utils-0.3 and copied all the bin content into C:\Qt\2010.05\mingw\bin.
        One problem is: I could't run "mingw32-make clean" because there is no Makefile in qt\qmake dir.
        So, I ran configure under qt dir. and let it create all the Makefiles.
        Next steps:

        1. run mingw32-make confclean (as suggested by the configure utility) and
          configure -debug-and-release -plugin-sql-mysql.
        2. cd src\plugins\sqldrivers\mysql.
        3. set MYSQL_PATH=c:\MySQL.
        4. reimp -d %MYSQL_PATH%\lib\opt\libmysql.lib.
        5. dlltool -k --input-def LIBMYSQL.def --dllname libmysql.dll --output-lib libmysql.a.
        6. qmake "INCLUDEPATH+=%MYSQL_PATH%include" "LIBS+=-L. -lmysql" mysql.pro
        7. under qt dir. run mingw32-make sub-src.

        After a couple of hours I got these errors:

        @C:\Qt\2010.05\qt\bin\moc.exe -DQT_SHARED -DQT_THREAD_SUPPORT -DUNICODE -DQT_LARG
        EFILE_SUPPORT -DJSC=QTJSC -Djscyyparse=qtjscyyparse -Djscyylex=qtjscyylex -Djscy
        yerror=qtjscyyerror -DWTF=QTWTF -DQT_BUILD_SCRIPT_LIB -DQT_NO_USING_NAMESPACE -D
        QLALR_NO_QSCRIPTGRAMMAR_DEBUG_INFO -DQT_MAKEDLL -DQT_NO_CAST_TO_ASCII -DQT_ASCII
        CAST_WARNINGS -DQT3_SUPPORT -DQT_MOC_COMPAT -DQT_USE_FAST_OPERATOR_PLUS -DQT_US
        E_FAST_CONCATENATION -D_USE_MATH_DEFINES -DBUILDING_QT
        _=1 -DWTF_USE_ACCELERATED
        COMPOSITING -DUSE_SYSTEM_MALLOC -DBUILDING_QT_ -DBUILDING_JavaScriptCore -DBUI
        LDING_WTF -DWTF_USE_JAVASCRIPTCORE_BINDINGS=1 -DWTF_CHANGES=1 -DNDEBUG -DJS_NO_E
        XPORT -DQT_DLL -DQT_CORE_LIB @tmp/moc/debug_shared/mocinclude.tmp -D__GNUC__ -DW
        IN32 api\qscriptextensionplugin.h -o tmp\moc\debug_shared\moc_qscriptextensionpl
        ugin.cpp
        api\qscriptextensionplugin.h:43: Error: Undefined interface
        mingw32-make[2]: *** [tmp/moc/debug_shared/moc_qscriptextensionplugin.cpp] Error 1
        mingw32-make[2]: Leaving directory C:/Qt/2010.05/qt/src/script' mingw32-make[1]: *** [debug-all] Error 2 mingw32-make[1]: Leaving directory C:/Qt/2010.05/qt/src/script'
        mingw32-make: *** [sub-script-sub_src_target_ordered] Error 2@

        My PATH is: %SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;c:\Program Files\Common Files\Lenovo;C:\Program Files\Common Files\Roxio Shared\10.0\DLLShared;C:\Program Files\Common Files\Roxio Shared\DLLShared;C:\Program Files\Common Files\Roxio Shared\DLLShared;C:\Program Files\Common Files\Roxio Shared\10.0\DLLShared;C:\Program Files\Lenovo\Client Security Solution;C:\Program Files\Intel\DMIX;C:\Program Files\Diskeeper Corporation\Diskeeper;C:\WINDOWS\system32\WindowsPowerShell\v1.0;C:\Program Files\IVI Foundation\VISA\WinNT\Bin;C:\Program Files\IVI Foundation\IVI\bin;C:\PROGRA~1\IVIFOU~1\VISA\WinNT\Bin;C:\Program Files\IVI Foundation\VISA\WinNT\Bin;C:\pvb\win-mingw\bin;C:\Qt\2010.05\qt\bin;C:\Qt\2010.05\mingw\bin;C:\MySQL\bin.

        1 Reply Last reply
        0
        • B Offline
          B Offline
          blex
          wrote on last edited by
          #4

          At the step 7 try to run make from the mysql plugin sources dir


          Oleksiy Balabay

          1 Reply Last reply
          0
          • B Offline
            B Offline
            blueyes
            wrote on last edited by
            #5

            Blex,

            Can I have an explanation for your request?

            1 Reply Last reply
            0
            • B Offline
              B Offline
              blex
              wrote on last edited by
              #6

              I do not compile mysql driver myself but I guess that the following may help:

              After running step 6 you will get Makefile in the %QTDIR%\src\plugins\sqldrivers\mysql\ directory

              Go to this directory and try to execute "make", or "mingw32-make"

              Your build fails on the step not related to mysql compilation.


              Oleksiy Balabay

              1 Reply Last reply
              0
              • B Offline
                B Offline
                blueyes
                wrote on last edited by
                #7

                I understand your point but If the original binaries coming along with SDK have been compiled using a different version of mingw or a different configuration, this probably won't work.

                1 Reply Last reply
                0
                • B Offline
                  B Offline
                  blex
                  wrote on last edited by
                  #8

                  Just for clarification: I suppose that you do all steps 1-7 from your instruction above with changes in according to my post.

                  mingw used for SDK build is not important to you, only Qt. Try to recompile Qt from sources. On modern PC it takes not more than 2 hours. You can pass to configure.exe the switches to include mysql plugin.

                  Probably, it is better to download qt sources separately and build them in other directory. After that just tell QtCreator what Qt version should be used.


                  Oleksiy Balabay

                  1 Reply Last reply
                  0
                  • B Offline
                    B Offline
                    blueyes
                    wrote on last edited by
                    #9

                    OK, blex. I'll try your idea first and if it doesn't fix the problem I will try downloading qt sources separately and build them. I will let you know the result.

                    Only another question: how can I tell QtCreator what Qt version should be used?

                    Thanks a lot for your time.

                    1 Reply Last reply
                    0
                    • B Offline
                      B Offline
                      blex
                      wrote on last edited by
                      #10

                      [quote author="blueyes" date="1291357867"]Only another question: how can I tell QtCreator what Qt version should be used?[/quote]

                      Anfortunately, I have localized UI on my PC, so, maybe English menus are slightly different: use Tools - Options - Qt4 - Qt versions


                      Oleksiy Balabay

                      1 Reply Last reply
                      0
                      • A Offline
                        A Offline
                        aurorius
                        wrote on last edited by
                        #11

                        I've updated the article from "pikopong":http://www.pikopong.com/blog/2010/04/11/how-to-enable-mysql-support-in-qt-sdk-for-windows/ with some additional information. But the guide still works, I've tested it in my Virtual Box with a clean Windows XP (never install Qt or MySQL before in it). You can see the full build process "here":http://pastie.org/1348501

                        1 Reply Last reply
                        0
                        • B Offline
                          B Offline
                          blueyes
                          wrote on last edited by
                          #12

                          The problem aurorius is, as I already said before, that this way I can build the driver but NOT the test application:

                          @#include <QtGui/QApplication>
                          #include <QCoreApplication>
                          #include <QDebug>
                          #include <QtSQL/QSqlDatabase>
                          #include "mainwindow.h"

                          int main(int argc, char *argv[])
                          {
                          QApplication a(argc, argv);
                          qDebug() << QSqlDatabase::drivers();

                          return a.exec&#40;&#41;;
                          

                          }@

                          Here are the errors I got:

                          @Running build steps for project SqlTest...
                          Configuration unchanged, skipping qmake step.
                          Starting: "C:/Qt/2010.05/mingw/bin/mingw32-make.exe" -w
                          mingw32-make: Entering directory `C:/Paolo/QtPtojects/SqlTest-build-desktop'

                          C:/Qt/2010.05/mingw/bin/mingw32-make -f Makefile.Debug

                          mingw32-make[1]: Entering directory `C:/Paolo/QtPtojects/SqlTest-build-desktop'

                          g++ -enable-stdcall-fixup -Wl,-enable-auto-import -Wl,-enable-runtime-pseudo-reloc -mthreads -Wl -Wl,-subsystem,windows -o debug\SqlTest.exe debug/main.o debug/mainwindow.o debug/moc_mainwindow.o -L"c:\Qt\2010.05\qt\lib" -lmingw32 -lqtmaind -lQtGuid4 -lQtCored4

                          mingw32-make[1]: Leaving directory `C:/Paolo/QtPtojects/SqlTest-build-desktop'

                          mingw32-make: Leaving directory `C:/Paolo/QtPtojects/SqlTest-build-desktop'

                          debug/main.o: In function `Z5qMainiPPc':

                          C:\Paolo\QtPtojects\SqlTest-build-desktop/../SqlTest/main.cpp:10: undefined reference to '_imp___ZN12QSqlDatabase7driversEv'

                          collect2: ld returned 1 exit status

                          mingw32-make[1]: *** [debug\SqlTest.exe] Error 1

                          mingw32-make: *** [debug] Error 2

                          The process "C:/Qt/2010.05/mingw/bin/mingw32-make.exe" exited with code %2.
                          Error while building project SqlTest (target: Desktop)
                          When executing build step 'Make'@

                          1 Reply Last reply
                          0
                          • A Offline
                            A Offline
                            aurorius
                            wrote on last edited by
                            #13

                            Just in case if you're wondering, this is the compile output for a working project

                            @Running build steps for project testmysql...
                            Configuration unchanged, skipping qmake step.
                            Starting: "C:/Qt/2010.05/mingw/bin/mingw32-make.exe" -w
                            mingw32-make: Entering directory `C:/Documents and Settings/root/My Documents/Projects/testmysql-build-desktop'

                            C:/Qt/2010.05/mingw/bin/mingw32-make -f Makefile.Debug

                            mingw32-make[1]: Entering directory `C:/Documents and Settings/root/My Documents/Projects/testmysql-build-desktop'

                            g++ -c -g -frtti -fexceptions -mthreads -Wall -DUNICODE -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_SQL_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -I"c:\Qt\2010.05\qt\include\QtCore" -I"c:\Qt\2010.05\qt\include\QtSql" -I"c:\Qt\2010.05\qt\include" -I"c:\Qt\2010.05\qt\include\ActiveQt" -I"debug" -I"..\testmysql" -I"." -I"c:\Qt\2010.05\qt\mkspecs\win32-g++" -o debug\main.o ..\testmysql\main.cpp

                            g++ -enable-stdcall-fixup -Wl,-enable-auto-import -Wl,-enable-runtime-pseudo-reloc -Wl,-subsystem,console -mthreads -Wl -o debug\testmysql.exe debug/main.o -L"c:\Qt\2010.05\qt\lib" -lQtSqld4 -lQtCored4

                            mingw32-make[1]: Leaving directory `C:/Documents and Settings/root/My Documents/Projects/testmysql-build-desktop'

                            mingw32-make: Leaving directory `C:/Documents and Settings/root/My Documents/Projects/testmysql-build-desktop'

                            The process "C:/Qt/2010.05/mingw/bin/mingw32-make.exe" exited normally.@

                            1 Reply Last reply
                            0
                            • B Offline
                              B Offline
                              blueyes
                              wrote on last edited by
                              #14

                              Eventually I've been able to figure out why it didn't build: I had to manually add to the .pro file the SQL module.

                              QT += core gui sql

                              Now it works!

                              Many thanks again for the support.

                              1 Reply Last reply
                              0
                              • I Offline
                                I Offline
                                IrQX
                                wrote on last edited by
                                #15

                                [quote author="blueyes" date="1291600372"]Eventually I've been able to figure out why it didn't build: I had to manually add to the .pro file the SQL module.

                                QT += core gui sql

                                Now it works!

                                Many thanks again for the support.[/quote]

                                Next time read proper documentation. Paragraph modules. where write such "if you using sql write QT += sql", "If you using GUI, write QT += gui", etc..

                                1 Reply Last reply
                                0
                                • C Offline
                                  C Offline
                                  chandan
                                  wrote on last edited by
                                  #16

                                  hi all...
                                  I am using ubuntu OS ..and I install Qt via downloading it from QT center.When I wrote this code I found only one driver that is "QSQLITE".
                                  so how to install that I can work with QMYSQL driver

                                  1 Reply Last reply
                                  0
                                  • F Offline
                                    F Offline
                                    franku
                                    wrote on last edited by
                                    #17

                                    You've got to configure an build Qt with the QMYSQL Database driver enabled.

                                    This, Jen, is the internet.

                                    1 Reply Last reply
                                    0

                                    • Login

                                    • Login or register to search.
                                    • First post
                                      Last post
                                    0
                                    • Categories
                                    • Recent
                                    • Tags
                                    • Popular
                                    • Users
                                    • Groups
                                    • Search
                                    • Get Qt Extensions
                                    • Unsolved