Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

MariaDB plugin



  • Hi, I'm trying to build a MariaDB driver, reading doc (https://doc.qt.io/qt-5/sql-driver.html#qmysql) and another info on internet, but I've this problem:

    C:\>cd C:\Users\Ste\Programmi\Qt\5.15.0\Src\qtbase\src\plugins\sqldrivers
    
    C:\Users\Ste\Programmi\Qt\5.15.0\Src\qtbase\src\plugins\sqldrivers>C:\Users\Stefano\Programmi\Qt\5.15.0\mingw81_64\bin\qmake -- "MYSQL_INCDIR=C:\Program Files\MariaDB\MariaDB Connector C 64-bit\include" "MYSQL_LIBDIR=C:\Program Files\MariaDB\MariaDB Connector C 64-bit\lib" -llibmariadb"
    Project ERROR: Cannot run compiler 'g++'. Output:
    ===================
    ===================
    Maybe you forgot to setup the environment?
    

    I tried to add on path "C:\Users\Ste\Programmi\Qt\5.15.0\mingw81_64\bin" but the result is the same.
    Can you help me?

    Thanks.

    Stefano


  • Lifetime Qt Champion

    Hi
    Try run the
    "C:\Qt\5.15.0\mingw81_64\bin\qtenv2.bat"
    before qmake



  • Hi and thanks for answer.
    With qtenv2.bat the situation has improved.
    The parameter "-libmariadb" gave an errore and I had to delete it.
    Moreover the procedure asked me to compile with mingw32 and not 64. Is normal?

    I would like to ask if you can tell me wich is the advantage to use Qt driver instead ODBC (sure more simple and rapid to configure).

    Thanks.

    P.S. The PC is still compiling the driver, I hope everything goes well until the end.



  • Compilation error :(

    In file included from qwindowsintegration.cpp:85:
    qwindowseglcontext.h:45:10: fatal error: EGL/egl.h: No such file or directory
     #include <EGL/egl.h>
              ^~~~~~~~~~~
    compilation terminated.
    mingw32-make[5]: *** [Makefile.Release:3296: .obj/release/qwindowsintegration.o] Error 1
    mingw32-make[5]: Leaving directory 'C:/Users/Stefano/Programmi/Qt/5.15.0/Src/qtbase/src/plugins/platforms/windows'
    mingw32-make[4]: *** [Makefile:45: release] Error 2
    mingw32-make[4]: Leaving directory 'C:/Users/Stefano/Programmi/Qt/5.15.0/Src/qtbase/src/plugins/platforms/windows'
    mingw32-make[3]: *** [Makefile:103: sub-windows-make_first] Error 2
    mingw32-make[3]: Leaving directory 'C:/Users/Stefano/Programmi/Qt/5.15.0/Src/qtbase/src/plugins/platforms'
    mingw32-make[2]: *** [Makefile:108: sub-platforms-make_first] Error 2
    mingw32-make[2]: Leaving directory 'C:/Users/Stefano/Programmi/Qt/5.15.0/Src/qtbase/src/plugins'
    mingw32-make[1]: *** [Makefile:834: sub-plugins-make_first] Error 2
    mingw32-make[1]: Leaving directory 'C:/Users/Stefano/Programmi/Qt/5.15.0/Src/qtbase/src'
    mingw32-make: *** [Makefile:54: sub-src-make_first] Error 2
    

    I try to install "DirectX SDK" (https://bugreports.qt.io/browse/QTBUG-65602) but have an error during installation, prerhaps I use a virtual machine !?


  • Lifetime Qt Champion

    @Stefanoxjx said in MariaDB plugin:

    I would like to ask if you can tell me wich is the advantage to use Qt driver instead ODBC

    From a programming perspective, there will be no different but it could be faster than ODBC, and might offer integration/features not available via ODBC but its not certain.

    Sorry about the compile error. I have never set it complains about
    EGL/egl.h: bulding the sql plugins. really strange. I have no idea why.


  • Lifetime Qt Champion

    @Stefanoxjx said in MariaDB plugin:

    In file included from qwindowsintegration.cpp:85:
    qwindowseglcontext.h:45:10: fatal error: EGL/egl.h: No such file or directory
    #include <EGL/egl.h>

    You don't have to compile the complete qt - please follow the instructions on how to build the driver, in a clean source dir.


  • Lifetime Qt Champion

    @Christian-Ehrlicher
    But in the first post it clearly looks like he is only building plugin ?


  • Lifetime Qt Champion

    @mrjj but not on the second - at least make / mingw32-make was run in the wrong directory



  • Hi, I'm returned :D
    I'm still trying to make mariadb driver, but I've a problem (as usual :( )
    This are my steps:

    • I moved to directory: \Qt\5.15.0\Src\qtbase\src\plugins\sqldrivers
    • I run command: \Qt\5.15.0\mingw81_64\bin\qmake -- MYSQL_INCDIR="C:/Program Files/MariaDB 10.5/include" MYSQL_LIBDIR="C:/Program Files/MariaDB 10.5/lib"
      but I've this result:
    Running configuration tests...
    Done running configuration tests.
    
    Configure summary:
    
    Qt Sql Drivers:
      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, you must run 'mingw32-make install'.
    Qt will be installed into '\Qt\5.15.0\mingw81_64'.
    
    Prior to reconfiguration, make sure you remove any leftovers from
    the previous build.
    

    Why MySql is = no?
    What am I missing, and why tell to run mingw32-make and not 64?
    Thanks for help.


  • Lifetime Qt Champion

    @Stefanoxjx said in MariaDB plugin:

    Why MySql is = no?

    As stated in the docs - take a look in the config.log and see why it does not find mysql libs in the directories you passed to qmake



  • Hi Christian and thanks for your help.
    To be honest, I don't find the documentation very clear.
    Probably because I don't very well English.

    This is Config.log:

    Command line: "MYSQL_INCDIR=C:/Program Files/MariaDB 10.5/include" "MYSQL_LIBDIR=C:/Program Files/MariaDB 10.5/lib" "MYSQL_LIBS=-llibmariadb"
    Global lib dirs: [C:\\openssl\\lib C:\\Utils\\my_sql\\mysql-5.7.25-winx64\\lib C:\\Utils\\postgresql\\pgsql\\lib] [D:/Programmi/Qt/Tools/mingw810_32/lib/gcc/i686-w64-mingw32/8.1.0 D:/Programmi/Qt/Tools/mingw810_32/lib/gcc D:/Programmi/Qt/Tools/mingw810_32/i686-w64-mingw32/lib D:/Programmi/Qt/Tools/mingw810_32/lib]
    Global inc dirs: [C:\\openssl\\include C:\\Utils\\my_sql\\mysql-5.7.25-winx64\\include C:\\Utils\\postgresql\\pgsql\\include] [D:/Programmi/Qt/Tools/mingw810_32/lib/gcc/i686-w64-mingw32/8.1.0/include/c++ D:/Programmi/Qt/Tools/mingw810_32/lib/gcc/i686-w64-mingw32/8.1.0/include/c++/i686-w64-mingw32 D:/Programmi/Qt/Tools/mingw810_32/lib/gcc/i686-w64-mingw32/8.1.0/include/c++/backward D:/Programmi/Qt/Tools/mingw810_32/lib/gcc/i686-w64-mingw32/8.1.0/include D:/Programmi/Qt/Tools/mingw810_32/lib/gcc/i686-w64-mingw32/8.1.0/include-fixed D:/Programmi/Qt/Tools/mingw810_32/i686-w64-mingw32/include]
    loaded result for library config.sqldrivers.libraries.db2
    Trying source 0 (type inline) of library db2 ...
    sqlcli.h not found in [] and global paths.
    sqlcli1.h not found in [] and global paths.
      => source produced no result.
    Trying source 1 (type inline) of library db2 ...
      => source failed condition '!config.win32'.
    test config.sqldrivers.libraries.db2 FAILED
    loaded result for library config.sqldrivers.libraries.ibase
    Trying source 0 (type inline) of library ibase ...
    ibase.h not found in [] and global paths.
      => source produced no result.
    Trying source 1 (type inline) of library ibase ...
      => source failed condition '!config.win32'.
    test config.sqldrivers.libraries.ibase FAILED
    loaded result for library config.sqldrivers.libraries.mysql
    Trying source 0 (type mysqlConfig) of library mysql ...
    mysql_config not found.
      => source produced no result.
    Trying source 1 (type mysqlConfig) of library mysql ...
    mysql_config not found.
      => source produced no result.
    Trying source 2 (type mysqlConfig) of library mysql ...
    mysql_config not found.
      => source produced no result.
    Trying source 3 (type mysqlConfig) of library mysql ...
    mysql_config not found.
      => source produced no result.
    Trying source 4 (type inline) of library mysql ...
      => source failed condition '!config.win32'.
    Trying source 5 (type inline) of library mysql ...
    + cd /d D:\Programmi\Qt\5.15.0\Src\qtbase\src\plugins\sqldrivers\config.tests\mysql && D:\Programmi\Qt\5.15.0\mingw81_64\bin\qmake.exe "CONFIG -= qt debug_and_release app_bundle lib_bundle" "CONFIG += shared warn_off console single_arch" "QMAKE_LIBDIR += C:\\openssl\\lib C:\\Utils\\my_sql\\mysql-5.7.25-winx64\\lib C:\\Utils\\postgresql\\pgsql\\lib" "INCLUDEPATH += C:\\openssl\\include C:\\Utils\\my_sql\\mysql-5.7.25-winx64\\include C:\\Utils\\postgresql\\pgsql\\include" "QMAKE_USE += mysql" "QMAKE_LIBS_MYSQL = \"-LC:\\Program Files\\MariaDB\\MariaDB Connector C 64-bit/lib\" -llibmariadb" "QMAKE_INCDIR_MYSQL = \"C:\\Program Files\\MariaDB\\MariaDB Connector C 64-bit/include\"" D:/Programmi/Qt/5.15.0/Src/qtbase/src/plugins/sqldrivers/config.tests/mysql
    > Info: creating stash file D:\Programmi\Qt\5.15.0\Src\qtbase\src\plugins\sqldrivers\config.tests\.qmake.stash
    + cd /d D:\Programmi\Qt\5.15.0\Src\qtbase\src\plugins\sqldrivers\config.tests\mysql && set MAKEFLAGS=& mingw32-make
    > g++ -c -fno-keep-inline-dllexport -O2 -w -fexceptions -mthreads -DUNICODE -D_UNICODE -DWIN32 -DMINGW_HAS_SECURE_API=1 -I. -IC:\openssl\include -IC:\Utils\my_sql\mysql-5.7.25-winx64\include -IC:\Utils\postgresql\pgsql\include -I"C:\Program Files\MariaDB\MariaDB Connector C 64-bit\include" -ID:\Programmi\Qt\5.15.0\mingw81_64\mkspecs\win32-g++  -o main.o main.cpp
    > g++ -Wl,-s -Wl,-subsystem,console -mthreads -o mysql.exe main.o  -LC:\openssl\lib -LC:\Utils\my_sql\mysql-5.7.25-winx64\lib -LC:\Utils\postgresql\pgsql\lib -L"C:\Program Files\MariaDB\MariaDB Connector C 64-bit\lib" -llibmariadb   
    > main.o:main.cpp:(.text.startup+0xc): undefined reference to `mysql_get_client_version@0'
    > collect2.exe: error: ld returned 1 exit status
    > mingw32-make: *** [Makefile:69: mysql.exe] Error 1
     => source failed verification.
    Trying source 6 (type inline) of library mysql ...
    + cd /d D:\Programmi\Qt\5.15.0\Src\qtbase\src\plugins\sqldrivers\config.tests\mysql && D:\Programmi\Qt\5.15.0\mingw81_64\bin\qmake.exe "CONFIG -= qt debug_and_release app_bundle lib_bundle" "CONFIG += shared warn_off console single_arch" "QMAKE_LIBDIR += C:\\openssl\\lib C:\\Utils\\my_sql\\mysql-5.7.25-winx64\\lib C:\\Utils\\postgresql\\pgsql\\lib" "INCLUDEPATH += C:\\openssl\\include C:\\Utils\\my_sql\\mysql-5.7.25-winx64\\include C:\\Utils\\postgresql\\pgsql\\include" "QMAKE_USE += mysql" "QMAKE_LIBS_MYSQL = \"-LC:\\Program Files\\MariaDB\\MariaDB Connector C 64-bit/lib\" -llibmysql" "QMAKE_INCDIR_MYSQL = \"C:\\Program Files\\MariaDB\\MariaDB Connector C 64-bit/include\"" D:/Programmi/Qt/5.15.0/Src/qtbase/src/plugins/sqldrivers/config.tests/mysql
    + cd /d D:\Programmi\Qt\5.15.0\Src\qtbase\src\plugins\sqldrivers\config.tests\mysql && set MAKEFLAGS=& mingw32-make clean && set MAKEFLAGS=& mingw32-make
    > del main.o
    > g++ -c -fno-keep-inline-dllexport -O2 -w -fexceptions -mthreads -DUNICODE -D_UNICODE -DWIN32 -DMINGW_HAS_SECURE_API=1 -I. -IC:\openssl\include -IC:\Utils\my_sql\mysql-5.7.25-winx64\include -IC:\Utils\postgresql\pgsql\include -I"C:\Program Files\MariaDB\MariaDB Connector C 64-bit\include" -ID:\Programmi\Qt\5.15.0\mingw81_64\mkspecs\win32-g++  -o main.o main.cpp
    > g++ -Wl,-s -Wl,-subsystem,console -mthreads -o mysql.exe main.o  -LC:\openssl\lib -LC:\Utils\my_sql\mysql-5.7.25-winx64\lib -LC:\Utils\postgresql\pgsql\lib -L"C:\Program Files\MariaDB\MariaDB Connector C 64-bit\lib" -llibmysql   
    > D:/Programmi/Qt/Tools/mingw810_32/bin/../lib/gcc/i686-w64-mingw32/8.1.0/../../../../i686-w64-mingw32/bin/ld.exe: cannot find -llibmysql
    > collect2.exe: error: ld returned 1 exit status
    > mingw32-make: *** [Makefile:69: mysql.exe] Error 1
     => source failed verification.
    Trying source 7 (type inline) of library mysql ...
      => source failed condition '!config.win32'.
    Trying source 8 (type inline) of library mysql ...
      => source failed condition '!config.win32'.
    test config.sqldrivers.libraries.mysql FAILED
    loaded result for library config.sqldrivers.libraries.oci
    Trying source 0 (type inline) of library oci ...
    oci.h not found in [] and global paths.
      => source produced no result.
    Trying source 1 (type inline) of library oci ...
      => source failed condition '!config.win32'.
    test config.sqldrivers.libraries.oci FAILED
    loaded result for library config.sqldrivers.libraries.odbc
    Trying source 0 (type inline) of library odbc ...
    + cd /d D:\Programmi\Qt\5.15.0\Src\qtbase\src\plugins\sqldrivers\config.tests\odbc && D:\Programmi\Qt\5.15.0\mingw81_64\bin\qmake.exe "CONFIG -= qt debug_and_release app_bundle lib_bundle" "CONFIG += shared warn_off console single_arch" "QMAKE_LIBDIR += C:\\openssl\\lib C:\\Utils\\my_sql\\mysql-5.7.25-winx64\\lib C:\\Utils\\postgresql\\pgsql\\lib" "INCLUDEPATH += C:\\openssl\\include C:\\Utils\\my_sql\\mysql-5.7.25-winx64\\include C:\\Utils\\postgresql\\pgsql\\include" "QMAKE_USE += odbc" "QMAKE_LIBS_ODBC = -lodbc32" D:/Programmi/Qt/5.15.0/Src/qtbase/src/plugins/sqldrivers/config.tests/odbc
    + cd /d D:\Programmi\Qt\5.15.0\Src\qtbase\src\plugins\sqldrivers\config.tests\odbc && set MAKEFLAGS=& mingw32-make
    > g++ -c -fno-keep-inline-dllexport -O2 -w -fexceptions -mthreads -DUNICODE -D_UNICODE -DWIN32 -DMINGW_HAS_SECURE_API=1 -I. -IC:\openssl\include -IC:\Utils\my_sql\mysql-5.7.25-winx64\include -IC:\Utils\postgresql\pgsql\include -ID:\Programmi\Qt\5.15.0\mingw81_64\mkspecs\win32-g++  -o main.o main.cpp
    > g++ -Wl,-s -Wl,-subsystem,console -mthreads -o odbc.exe main.o  -LC:\openssl\lib -LC:\Utils\my_sql\mysql-5.7.25-winx64\lib -LC:\Utils\postgresql\pgsql\lib -lodbc32   
     => source accepted.
    test config.sqldrivers.libraries.odbc succeeded
    loaded result for library config.sqldrivers.libraries.psql
    Trying source 0 (type pkgConfig) of library psql ...
    pkg-config use disabled globally.
      => source produced no result.
    Trying source 1 (type psqlConfig) of library psql ...
    pg_config not found.
      => source produced no result.
    Trying source 2 (type psqlEnv) of library psql ...
    libpq-fe.h not found in [] and global paths.
      => source produced no result.
    Trying source 3 (type psqlEnv) of library psql ...
      => source failed condition '!config.win32'.
    test config.sqldrivers.libraries.psql FAILED
    loaded result for library config.sqldrivers.libraries.sqlite2
    Trying source 0 (type inline) of library sqlite2 ...
    sqlite.h not found in [] and global paths.
      => source produced no result.
    test config.sqldrivers.libraries.sqlite2 FAILED
    loaded result for library config.sqldrivers.libraries.tds
    Trying source 0 (type sybaseEnv) of library tds ...
    + cd /d D:\Programmi\Qt\5.15.0\Src\qtbase\src\plugins\sqldrivers\config.tests\tds && D:\Programmi\Qt\5.15.0\mingw81_64\bin\qmake.exe "CONFIG -= qt debug_and_release app_bundle lib_bundle" "CONFIG += shared warn_off console single_arch" "QMAKE_LIBDIR += C:\\openssl\\lib C:\\Utils\\my_sql\\mysql-5.7.25-winx64\\lib C:\\Utils\\postgresql\\pgsql\\lib" "INCLUDEPATH += C:\\openssl\\include C:\\Utils\\my_sql\\mysql-5.7.25-winx64\\include C:\\Utils\\postgresql\\pgsql\\include" "QMAKE_USE += tds" "QMAKE_LIBS_TDS = -lNTWDBLIB" D:/Programmi/Qt/5.15.0/Src/qtbase/src/plugins/sqldrivers/config.tests/tds
    + cd /d D:\Programmi\Qt\5.15.0\Src\qtbase\src\plugins\sqldrivers\config.tests\tds && set MAKEFLAGS=& mingw32-make
    > g++ -c -fno-keep-inline-dllexport -O2 -w -fexceptions -mthreads -DUNICODE -D_UNICODE -DWIN32 -DMINGW_HAS_SECURE_API=1 -I. -IC:\openssl\include -IC:\Utils\my_sql\mysql-5.7.25-winx64\include -IC:\Utils\postgresql\pgsql\include -ID:\Programmi\Qt\5.15.0\mingw81_64\mkspecs\win32-g++  -o main.o main.cpp
    > main.cpp:2:10: fatal error: sybfront.h: No such file or directory
    >  #include <sybfront.h>
    >           ^~~~~~~~~~~~
    > compilation terminated.
    > mingw32-make: *** [Makefile:498: main.o] Error 1
     => source failed verification.
    Trying source 1 (type sybaseEnv) of library tds ...
      => source failed condition '!config.win32'.
    test config.sqldrivers.libraries.tds FAILED
    
    

    I tried to follow the steps in this discussion: https://forum.qt.io/topic/90065/how-to-create-the-plugin-of-mariadb-for-qt5/19

    But when SGaist ask to compile into mysql folder, I've a different error:

    Project ERROR: Library 'mysql' is not defined.
    

  • Moderators

    Hi @Stefanoxjx, I'm seeing several different paths in your posts:

    • C:\Program Files\MariaDB\MariaDB Connector C 64-bit\include
    • C:\Program Files\MariaDB 10.5\include
    • C:\Utils\my_sql\mysql-5.7.25-winx64\include

    Please double-check where you've installed MySQL or MariaDB. Where is mysql.h? Where is libmysql.lib or libmariadb.lib?



  • Hi, you see different paths because initially I had MariaDB connector installed too.
    Now MariaDB connector is unistalled.
    Answering your questions:
    MariaDB is installed to: C:\Program Files\MariaDB 10.5
    mysql.h is to: C:\Program Files\MariaDB 10.5\include\mysql
    libmariadb.lib is to: C:\Program Files\MariaDB 10.5\lib

    Now, I recheck paths and execute these steps:

    set path=%path%;C:\Program Files\MariaDB 10.5\lib;C:\Program Files\MariaDB 10.5\include;C:\Program Files\MariaDB 10.5\include\mysql;D:\Programmi\Qt\5.15.0\mingw81_64\bin
    
    cd D:\Programmi\Qt\5.15.0\Src\qtbase\src\plugins\sqldrivers\mysql
    
    qmake -- MYSQL_INCDIR="C:/Program Files/MariaDB 10.5/include/;C:/Program Files/MariaDB 10.5/include/Mysql" MYSQL_LIBDIR="C:/Program Files/MariaDB 10.5/lib" MYSQL_LIBS="-llibmariadb"
    

    and result is the same: MYSQL = NO


  • Lifetime Qt Champion

    @Stefanoxjx said in MariaDB plugin:

    and result is the same: MYSQL = NO

    And again you did not look into the config.log to see where the error is... I'm giving up.



  • @Christian-Ehrlicher said in MariaDB plugin:

    And again you did not look into the config.log to see where the error is.

    No Christian, I'm watched config.log, but is the same already posted:

    loaded result for library config.sqldrivers.libraries.mysql
    Trying source 0 (type mysqlConfig) of library mysql ...
    mysql_config not found.
      => source produced no result.
    Trying source 1 (type mysqlConfig) of library mysql ...
    mysql_config not found.
      => source produced no result.
    Trying source 2 (type mysqlConfig) of library mysql ...
    mysql_config not found.
      => source produced no result.
    Trying source 3 (type mysqlConfig) of library mysql ...
    mysql_config not found.
      => source produced no result.
    Trying source 4 (type inline) of library mysql ...
      => source failed condition '!config.win32'.
    Trying source 5 (type inline) of library mysql ...
    

  • Moderators

    @Stefanoxjx said in MariaDB plugin:

    Command line: "MYSQL_INCDIR=C:/Program Files/MariaDB 10.5/include" "MYSQL_LIBDIR=C:/Program Files/MariaDB 10.5/lib" "MYSQL_LIBS=-llibmariadb"

    Well, your mysql.h is not found in C:\Program Files\MariaDB 10.5\include so that's why it failed here.

    @Stefanoxjx said in MariaDB plugin:

    No Christian, I'm watched config.log, but is the same already posted:

    If you pass different command line arguments to qmake, then the config.log will definitely contain different text.

    (Also, remember to delete all the output files before you call qmake again)

    loaded result for library config.sqldrivers.libraries.mysql
    Trying source 0 (type mysqlConfig) of library mysql ...
    mysql_config not found.
      => source produced no result.
    Trying source 1 (type mysqlConfig) of library mysql ...
    mysql_config not found.
      => source produced no result.
    Trying source 2 (type mysqlConfig) of library mysql ...
    mysql_config not found.
      => source produced no result.
    Trying source 3 (type mysqlConfig) of library mysql ...
    mysql_config not found.
      => source produced no result.
    Trying source 4 (type inline) of library mysql ...
      => source failed condition '!config.win32'.
    Trying source 5 (type inline) of library mysql ...
    

    Post the whole log, not just that small part.



  • Hi JKSH, I've solved now.
    I tried to build the plugin from another PC and it worked right away.
    The slashes instead of back slashes in MariaDB path was childs of various desperate tests.

    Thanks at all for help.


Log in to reply