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. [SOLVED]Trying to build mysql driver in Qt 5.1.0 and MySQL 5.6
Forum Updated to NodeBB v4.3 + New Features

[SOLVED]Trying to build mysql driver in Qt 5.1.0 and MySQL 5.6

Scheduled Pinned Locked Moved Installation and Deployment
38 Posts 9 Posters 35.1k Views 3 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.
  • K Offline
    K Offline
    koresaram777
    wrote on last edited by
    #12

    Thanks very much everybody! The problem is solved :)

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #13

      Great !

      Then don't forget to update the thread's title to solved, so other forum users may know a solution has been found :)

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • VinorcolaV Offline
        VinorcolaV Offline
        Vinorcola
        wrote on last edited by
        #14

        Hello,

        It would have been nice to tell us how you solved your problem koresaram777.

        Indeed, I follow every indication, download the C connector sources archives and then the C++ one, but still, I can't compile the plugin. There is no C++ file into those archive (only headers files).

        I did some research but every time I have got a topic that says a different way. And I always still have those error messages:

        undefined references to mysql_num_rows@4, mysql_stmt_num_rows@4, etc.

        My computer is a 32bits so I only used (and download) the tools for 32bits. I say that because main of forum topic says that the problème come when using 64bits sources when the installed version of MySQL is 32bits.

        If someone can help me. Thanks.

        1 Reply Last reply
        0
        • K Offline
          K Offline
          koresaram777
          wrote on last edited by
          #15

          [quote author="Vinorcola" date="1380787942"]Hello,

          It would have been nice to tell us how you solved your problem koresaram777.

          Indeed, I follow every indication, download the C connector sources archives and then the C++ one, but still, I can't compile the plugin. There is no C++ file into those archive (only headers files).

          I did some research but every time I have got a topic that says a different way. And I always still have those error messages:

          undefined references to mysql_num_rows@4, mysql_stmt_num_rows@4, etc.

          My computer is a 32bits so I only used (and download) the tools for 32bits. I say that because main of forum topic says that the problème come when using 64bits sources when the installed version of MySQL is 32bits.

          If someone can help me. Thanks.[/quote]

          when you download the c connector, you need to install it, after installation create the empty folder in c disk, after this just copy all you files from C:\Program Files\MySQL\Connector C++\ to your new folder, and rename this folder for example mySQL, but do it without spaces. and aflter that when you compile reference to that folder which you created before and that's all :)

          1 Reply Last reply
          0
          • VinorcolaV Offline
            VinorcolaV Offline
            Vinorcola
            wrote on last edited by
            #16

            I did what you said, but have still have the same error. Can someone help me? Or send me the compile plugin?

            Thanks

            1 Reply Last reply
            0
            • K Offline
              K Offline
              koresaram777
              wrote on last edited by
              #17

              [quote author="Vinorcola" date="1380803548"]I did what you said, but have still have the same error. Can someone help me? Or send me the compile plugin?

              Thanks[/quote]

              give your email and what qt version do you have?

              1 Reply Last reply
              0
              • K Offline
                K Offline
                Kerox3562
                wrote on last edited by
                #18

                Hi,

                I've got some problems to compile Mysql driver, is something obvious for you ?

                @cd C:\Qt\Qt5.1.1\5.1.1\Src\qtbase\src\plugins\sqldrivers\mysql

                set mysql="C:\\PROGRA~1\\MySQL\\MYSQLS~1.6"

                qmake "INCLUDEPATH+=%mysql%\include\" "LIBS += -L %mysql%\lib\libmysql.lib" -o Makefile mysql.pro

                mingw32-make@

                @g++ -Wl,-s -shared -Wl,--out-implib,C:\Qt\Qt5.1.1\5.1.1\Src\qtbase\plugins\sqldr
                ivers\libqsqlmysql.a -o ........\plugins\sqldrivers\qsqlmysql.dll .obj/releas
                e_shared/main.o .obj/release_shared/qsql_mysql.o .obj/release_shared/moc_qsql_my
                sql_p.o -llibmysql -LC:\Qt\Qt5.1.1\5.1.1\mingw48_32\lib -lQt5Sql -lQt5Core
                c:/qt/qt5.1.1/tools/mingw48_32/bin/../lib/gcc/i686-w64-mingw32/4.8.0/../../../..
                /i686-w64-mingw32/bin/ld.exe: cannot find -llibmysql
                collect2.exe: error: ld returned 1 exit status
                Makefile.Release:80: recipe for target '........\plugins\sqldrivers\qsqlmysql
                .dll' failed
                mingw32-make[1]: *** [........\plugins\sqldrivers\qsqlmysql.dll] Error 1
                mingw32-make[1]: Leaving directory 'C:/Qt/Qt5.1.1/5.1.1/Src/qtbase/src/plugins/s
                qldrivers/mysql'
                makefile:38: recipe for target 'release-all' failed
                mingw32-make: *** [release-all] Error 2@

                1 Reply Last reply
                0
                • SGaistS Offline
                  SGaistS Offline
                  SGaist
                  Lifetime Qt Champion
                  wrote on last edited by
                  #19

                  @ "LIBS += -L %mysql%\lib\libmysql.lib"@

                  That's your problem, -L is to give a path not a library name

                  Interested in AI ? www.idiap.ch
                  Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                  1 Reply Last reply
                  0
                  • M Offline
                    M Offline
                    morker
                    wrote on last edited by
                    #20

                    Thanks for your post's!

                    I got an issue if I want to build my driver. I'm using qt 5.3 and mysql 5.6 (mysql-5.6.20-win32).

                    I added mysql.pro to qt creator and add the following two lines to the .pro file:

                    @
                    LIBS += C:/mysql/mysql-5.6.20-win32lib/libmysql.lib
                    INCLUDEPATH += C:/mysql/mysql-5.6.20-win32/include
                    @

                    I got the following errors if i want to compile the mysql project:

                    C:\mysql\mysql-5.6.20-win32\include\mysql_com.h:320: error: C2146: Syntaxfehler: Fehlendes ';' vor Bezeichner 'fd'

                    C:\mysql\mysql-5.6.20-win32\include\mysql_com.h:320: error: C4430: Fehlender Typspezifizierer - int wird angenommen. Hinweis: "default-int" wird von C++ nicht untersttzt.

                    C:\mysql\mysql-5.6.20-win32\include\mysql_com.h:320: error: C2146: Syntaxfehler: Fehlendes ';' vor Bezeichner 'fd'

                    C:\mysql\mysql-5.6.20-win32\include\mysql_com.h:320: error: C4430: Fehlender Typspezifizierer - int wird angenommen. Hinweis: "default-int" wird von C++ nicht untersttzt.

                    C:\work\build\qt5\qtbase\src\sql\drivers\mysql\qsql_mysql.cpp:44: error: C1083: Datei (Include) kann nicht ge”ffnet werden: "QtSql/private/qsqldriver_p.h": No such file or directory

                    Many thanks for your help!

                    1 Reply Last reply
                    0
                    • SGaistS Offline
                      SGaistS Offline
                      SGaist
                      Lifetime Qt Champion
                      wrote on last edited by
                      #21

                      Hi and welcome to devnet,

                      Did you first build Qt 5 yourself ?

                      Interested in AI ? www.idiap.ch
                      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                      1 Reply Last reply
                      0
                      • M Offline
                        M Offline
                        morker
                        wrote on last edited by
                        #22

                        Hi SGaist,

                        yes I built qt5 by my self. I also tried to build the drivers with the following commands (see http://qt-project.org/doc/qt-4.8/sql-driver.html#how-to-build-the-qmysql-plugin-on-windows):

                        cd C:\work\build\qt5\qtbase\src\plugins\sqldrivers\mysql

                        qmake "INCLUDEPATH+=C:\mysql\mysql-5.6.20-win32\include" "LIBS+=C:\mysql\mysql-5.6.20-win32\lib\libmysql.lib" mysql.pro

                        mingw32-make

                        If I do the "mingw32-make" command I got the following errors:

                        C:\work\build\qt5\qtbase\src\plugins\sqldrivers\mysql>mingw32-make
                        mingw32-make -f Makefile.Release all
                        mingw32-make[1]: Entering directory 'C:/work/build/qt5/qtbase/src/plugins/sqldri
                        vers/mysql'
                        Makefile.Release:65: *** missing separator. Stop.
                        mingw32-make[1]: Leaving directory 'C:/work/build/qt5/qtbase/src/plugins/sqldriv
                        ers/mysql'
                        mingw32-make[1]: Leaving directory 'C:/work/build/qt5/qtbase/src/plugins/sqldriv
                        ers/mysql'
                        Makefile:40: recipe for target 'release-all' failed
                        mingw32-make: *** [release-all] Error 2

                        1 Reply Last reply
                        0
                        • SGaistS Offline
                          SGaistS Offline
                          SGaist
                          Lifetime Qt Champion
                          wrote on last edited by
                          #23

                          You're on windows either escape the backslashes or since you are using Qt use the unix notation i.e. forward slashes

                          Interested in AI ? www.idiap.ch
                          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                          1 Reply Last reply
                          0
                          • M Offline
                            M Offline
                            morker
                            wrote on last edited by
                            #24

                            I'm working on a windows machine. You can see in my post that I'm setting the INCLUDEPATH and the LIBS with \

                            What means this error exactly:

                            Makefile.Release:65: *** missing separator. Stop.

                            1 Reply Last reply
                            0
                            • SGaistS Offline
                              SGaistS Offline
                              SGaist
                              Lifetime Qt Champion
                              wrote on last edited by
                              #25

                              I know you are, and I already wrote the options you have:

                              • escape the \ so in practice use \
                              • Since you are using Qt use /

                              Second option is cleaner.

                              Interested in AI ? www.idiap.ch
                              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                              1 Reply Last reply
                              0
                              • M Offline
                                M Offline
                                morker
                                wrote on last edited by
                                #26

                                Sorry for that stupid questions. I'm using the QT 5.4.0 64-bit for Desktop (MSVC 2013) command line.

                                I got the same errors if I'm setting the paths like:

                                qmake "INCLUDEPATH+=C:\mysql\mysql-5.6.20-win32\include" "LIBS+=C:\mysql\mysql-5.6.20-win32\lib\libmysql.lib" mysql.pro

                                or:

                                qmake "INCLUDEPATH+=C:/mysql/mysql-5.6.20-win32/include" "LIBS+=C:/mysql/mysql-5.6.20-win32/lib/libmysql.lib" mysql.pro

                                or does it mean that I have to set the slashes in the Makefile.Release instead of \ to /

                                Many thanks.

                                1 Reply Last reply
                                0
                                • M Offline
                                  M Offline
                                  morker
                                  wrote on last edited by
                                  #27

                                  Ok, i was googling the problem. I get the error in the Makefile.Release in line 65:

                                  @{......\sql\drivers\mysql}.cpp{.obj\release}.obj::
                                  $(CXX) -c $(CXXFLAGS) $(INCPATH) -Fo.obj\release\ @<<
                                  $<
                                  <<@

                                  I get the error in line "<<"

                                  I add before "<<" a tab, so "\T<<". After I fired the mingw32-make command I still got the same problem. It seems to me that the Make.Release and Make.Debug files are generated each time if I do the mingw32-make command.

                                  Where can I set this behavior?

                                  1 Reply Last reply
                                  0
                                  • SGaistS Offline
                                    SGaistS Offline
                                    SGaist
                                    Lifetime Qt Champion
                                    wrote on last edited by
                                    #28

                                    First thing to do is to delete that folder content and restart

                                    Interested in AI ? www.idiap.ch
                                    Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                                    1 Reply Last reply
                                    0
                                    • D Offline
                                      D Offline
                                      Dark2011
                                      wrote on last edited by
                                      #29

                                      I have the same problem "Makefile.Release:65: *** missing separator"
                                      and i looked in Makefile.Release and didn't find missing separator)
                                      There were my steps:

                                      1. create folder [tempMySQL] with include and lib folders from mysqlserver folder
                                        It's look like this
                                        c:\qt\qt5.3.1\tempMySQL

                                      2. open mingw console and go to "C:\Qt\Qt5.3.1\5.3\Src\qtbase\src\plugins\sqldrivers\mysql"

                                      3. qmake "INCLUDEPATH+=C:\Qt\Qt5.3.1\tempMySQL\include" "LIBS+=C:\Qt\Qt5.3.1\tempMySQL\libmysql.lib" mysql.pro

                                      4. mingw32-make

                                      I didn't build Qt5.3.1 by myself, i just download
                                      Qt 5.3.1 for Windows 32-bit (MinGW 4.8.2, OpenGL, 737 MB) (Info) from here

                                      And when i worked with Qt 4.8.4 with VS2010 i didn't have a problem.
                                      I got all those steps then i describe above and it build and worked wihout any problem

                                      And of course i add mingw to PATH

                                      1 Reply Last reply
                                      0
                                      • D Offline
                                        D Offline
                                        Dark2011
                                        wrote on last edited by
                                        #30

                                        remark: when i build this driver for Qt4.8.4 and VS2010 i used nmake, of course)

                                        1 Reply Last reply
                                        0
                                        • SGaistS Offline
                                          SGaistS Offline
                                          SGaist
                                          Lifetime Qt Champion
                                          wrote on last edited by
                                          #31

                                          Is libmysql.lib the static MySQL client lib ?

                                          Interested in AI ? www.idiap.ch
                                          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                                          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