Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How to create the plugin of MARIADB for Qt5
Forum Updated to NodeBB v4.3 + New Features

How to create the plugin of MARIADB for Qt5

Scheduled Pinned Locked Moved Solved General and Desktop
20 Posts 4 Posters 7.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.
  • blackout69B Offline
    blackout69B Offline
    blackout69
    wrote on last edited by
    #5

    Thank you jsulm,
    I've run the following command:

    cd C:\Qt\5.10.1\Src\qtbase\src\plugins\sqldrivers\mysql\
    qmake -- MYSQL_INCDIR=C:\\PROGRA~2\\MARIAD~1.2\\include "MYSQL_LIBDIR=C:\\PROGRA~2\\MARIAD~1.2\\lib"
    

    I get this output

    Running configuration tests...
    Done running configuration tests.

    Configure summary:

    Qt Sql:
    DB2 (IBM) .............................. no
    InterBase .............................. no
    MySql .................................. no
    OCI (Oracle) ........................... no
    ODBC ................................... yes
    PostgreSQL ............................. no
    SQLite2 ................................ no
    SQLite ................................. yes
    Using system provided SQLite ......... no
    TDS (Sybase) ........................... no

    Qt is now configured for building. Just run 'mingw32-make'.
    Once everything is built, Qt is installed.
    You should NOT run 'mingw32-make install'.
    Note that this build cannot be deployed to other machines or devices.

    Prior to reconfiguration, make sure you remove any leftovers from
    the previous build.

    mingw32-make
    

    The drivers have been compiled for sqlite and odbc.
    I want to compile the driver for mariadb.
    How can I enable mariadb driver compilation.

    Thanks in advance
    blackout69

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

      You should check the content of the tests to see what failed for MySQL.

      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
      2
      • blackout69B Offline
        blackout69B Offline
        blackout69
        wrote on last edited by
        #7

        Hi all,

        I checked the tests, but the config.tests folder is automatically generated when I run the qmake command. It is not clear who decides and with which criteria which drivers to enable and which do not. Consider that I also installed MariaDB Connector, but it does not change anything.
        One thing I noticed instead is with the latest version of MariaDB, in the lib folder, there is no libmysql library but I find libmariadb.
        Perhaps the script that manages the enabling of the drivers, search for libmysql and not finding it does not enable mysql?

        Thanks in advance

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

          Hence my question about the content of the folder after it has been created.

          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
          • blackout69B Offline
            blackout69B Offline
            blackout69
            wrote on last edited by blackout69
            #9

            Hi SGaist,
            config.tests.zip

            My config.tests folder.
            blackout69

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

              What do you get if you call make in the mysql subfolder ?

              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
              • blackout69B Offline
                blackout69B Offline
                blackout69
                wrote on last edited by
                #11
                C:\Qt\5.10.1\Src\qtbase\src\plugins\sqldrivers\config.tests\mysql>mingw32-make
                g++ -c -fno-keep-inline-dllexport -O2 -std=gnu++11 -w -fexceptions -mthreads -DUNICODE -D_UNICODE -DWIN32 -I. -IC:\utils\my_sql\my_sql\include -IC:\utils\postgresql\pgsql\include -IC:\openssl\include -IC:\PROGRA~2\MARIAD~1.2\include -IC:\Qt\5.10.1\mingw53_32\mkspecs\win32-g++  -o main.o main.cpp
                main.cpp:5:19: fatal error: mysql.h: No such file or directory
                compilation terminated.
                Makefile:439: recipe for target 'main.o' failed
                mingw32-make: *** [main.o] Error 1
                
                1 Reply Last reply
                0
                • SGaistS Offline
                  SGaistS Offline
                  SGaist
                  Lifetime Qt Champion
                  wrote on last edited by
                  #12

                  Where exactly do you have that file in your system ?

                  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
                  • blackout69B Offline
                    blackout69B Offline
                    blackout69
                    wrote on last edited by
                    #13

                    C:\Program Files (x86)\MariaDB 10.2\include\mysql
                    C:\Program Files (x86)\MariaDB 10.2\include\mysql\server

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

                      Then you are missing the mysql folder in the path given to MYSQL_INCDIR

                      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
                      • blackout69B Offline
                        blackout69B Offline
                        blackout69
                        wrote on last edited by
                        #15

                        qmake -- MYSQL_INCDIR=C:\PROGRA~2\MARIAD~1.2\include\mysql "MYSQL_LIBDIR=C:\PROGRA~2\MARIAD~1.2\lib"

                        Configure summary:

                        Qt Sql:
                        DB2 (IBM) .............................. no
                        InterBase .............................. no
                        MySql .................................. no
                        OCI (Oracle) ........................... no
                        ODBC ................................... yes
                        PostgreSQL ............................. no
                        SQLite2 ................................ no
                        SQLite ................................. yes
                        Using system provided SQLite ......... no
                        TDS (Sybase) ........................... no

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

                          Again, check what happens if you try to build the MySQL test application.

                          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
                          • blackout69B Offline
                            blackout69B Offline
                            blackout69
                            wrote on last edited by
                            #17

                            C:\Qt\5.10.1\Src\qtbase\src\plugins\sqldrivers\config.tests\mysql>mingw32-make
                            g++ -Wl,-s -Wl,-subsystem,console -mthreads -o mysql.exe main.o -LC:\utils\my_sql\my_sql\lib -LC:\utils\postgresql\pgsql\lib -LC:\PROGRA~2\MARIAD~1.2\lib -llibmysql
                            C:/Qt/Tools/mingw530_32/bin/../lib/gcc/i686-w64-mingw32/5.3.0/../../../../i686-w64-mingw32/bin/ld.exe: cannot find -llibmysql
                            collect2.exe: error: ld returned 1 exit status
                            Makefile:64: recipe for target 'mysql.exe' failed
                            mingw32-make: *** [mysql.exe] Error 1

                            My lib folder is:
                            C:\Program Files (x86)\MariaDB 10.2\lib
                            libmariadb.dll
                            libmariadb.lib
                            libmariadb.pdb
                            mariadbclient.lib
                            mysqlservices.lib

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

                              Try setting MYSQL_LIBS to -lmariadb in addition to the other variables you already set.

                              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
                              • blackout69B Offline
                                blackout69B Offline
                                blackout69
                                wrote on last edited by blackout69
                                #19

                                qmake -- MYSQL_INCDIR=C:\PROGRA~2\MARIAD~1.2\include\mysql "MYSQL_LIBDIR=C:\PROGRA~2\MARIAD~1.2\lib" MYSQL_LIBS="-llibmariadb"

                                OK this work.
                                Thank you for your dedicated time.

                                blackout69

                                C 1 Reply Last reply
                                0
                                • blackout69B blackout69

                                  qmake -- MYSQL_INCDIR=C:\PROGRA~2\MARIAD~1.2\include\mysql "MYSQL_LIBDIR=C:\PROGRA~2\MARIAD~1.2\lib" MYSQL_LIBS="-llibmariadb"

                                  OK this work.
                                  Thank you for your dedicated time.

                                  blackout69

                                  C Offline
                                  C Offline
                                  cawlfj
                                  wrote on last edited by
                                  #20

                                  @blackout69

                                  I follow your step to build static mysql but got fail

                                  0: set mysql=c:\mysql
                                  1: cd C:\Qt\Qt5.12.0\5.12.0\Src\qtbase\src\plugins\sqldrivers
                                  2: qmake sqldrivers.pro
                                  3: cd C:\Qt\Qt5.12.0\5.12.0\Src\qtbase\src\plugins\sqldrivers\mysql
                                  4: qmake -- MYSQL_INCDIR=C:\mysql\include "MYSQL_LIBDIR=C:\mysql\lib" MYSQL_LIBS="-lmariadbclient"
                                  got error after this step
                                  Project ERROR: Library 'mysql' is not defined.
                                  5: cd C:\Qt\Qt5.12.0\5.12.0\Src\qtbase\src\plugins\sqldrivers
                                  6: qmake -- MYSQL_INCDIR=C:\mysql\include "MYSQL_LIBDIR=C:\mysql\lib" MYSQL_LIBS="-lmariadbclient"
                                  no error after this step
                                  7: nmake sub-mysql
                                  got error after this step
                                  NMAKE : fatal error U1073: 不知道如何生成“sub-mysql” Stop.
                                  ( NMAKE : fatal error U1073: don't know how to generate “sub-mysql” Stop.)

                                  could you help me to correct the steps?
                                  I don't know which step or path is wrong.
                                  Many thanks .

                                  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