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

Qt 5.15 mysql plugin on Debian 10



  • Hi all,
    I just installed Qt 5.15 on my debian 10 machine and I need to build mysql plugin.
    It seems I can't build plugin and I don't know why.
    I'm following https://doc.qt.io/qt-5/sql-driver.html but I'm continuing to receive:

    Project ERROR: Library 'mysql' is not defined.

    Where do I wrong?
    I compiled in the past mysql plugin on previous debian version.

    Thanks



  • @luca

    Hi

    i have solution for it
    open the terminal and run following command

    sudo apt-get install libqt5sql5-mysql


  • Lifetime Qt Champion

    Hi,

    What sources are you using to build the plugin ?
    If not a new one, did you clean it up before starting the new build ?



  • @Ketan__Patel__0011 Thanks but I need to compile it, not to use a built version.



  • @SGaist
    I'm using Qt 5.15.0 source.
    Is there some compatibility version to be used for mariadb/mysql dev libraries?



  • OK, I just tried from tar.gz source and now it seems I can build MySql plugin:

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

    I had problem using Src dir inside Qt installed using online installer....

    What should be the reason?


  • Lifetime Qt Champion

    Without checking the test logs, no way to tell.



  • I tried again from Qt installed with online installer:

    ./configure .... -v
    ...
    ...
    ...
    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 ...
    mysql.h not found in [] and global paths.
      => source produced no result.
    Trying source 5 (type inline) of library mysql ...
      => source failed condition 'config.win32'.
    Trying source 6 (type inline) of library mysql ...
      => source failed condition 'config.win32'.
    Trying source 7 (type inline) of library mysql ...
    mysql.h not found in [] and global paths.
      => source produced no result.
    Trying source 8 (type inline) of library mysql ...
    mysql.h not found in [] and global paths.
      => source produced no result.
    

    while from Qt from tar.gz source:

    ./configure .... -v
    ...
    ...
    ...
    Trying source 0 (type mysqlConfig) of library mysql ...
    + /usr/bin/mysql_config --version
    > 10.3.23
    + /usr/bin/mysql_config --libs_r
    > -L/usr/lib/x86_64-linux-gnu/ -lmariadb
    + /usr/bin/mysql_config --include
    > -I/usr/include/mariadb -I/usr/include/mariadb/mysql
    + cd /mnt/temporanea/Downloads/qt-everywhere-src-5.15.0/config.tests/mysql && /mnt/temporanea/Downloads/qt-everywhere-src-5.15.0/qtbase/bin/qmake "CONFIG -= qt debug_and_release app_bundle lib_bundle" "CONFIG += static warn_off console single_arch" 'QMAKE_USE += mysql' 'QMAKE_LIBS_MYSQL = -L/usr/lib/x86_64-linux-gnu/' 'QMAKE_INCDIR_MYSQL = /usr/include/mariadb /usr/include/mariadb/mysql' /mnt/temporanea/Downloads/qt-everywhere-src-5.15.0/config.tests/mysql
    + cd /mnt/temporanea/Downloads/qt-everywhere-src-5.15.0/config.tests/mysql && MAKEFLAGS= /usr/bin/make
    > g++ -c -pipe -O2 -w -fPIC  -I. -isystem /usr/include/mariadb -isystem /usr/include/mariadb/mysql -I/mnt/temporanea/Downloads/qt-everywhere-src-5.15.0/qtbase/mkspecs/linux-g++ -o main.o main.cpp
    > g++ -Wl,-O1 -o mysql main.o   -L/usr/lib/x86_64-linux-gnu/   
    > /usr/bin/ld: main.o: in function `main':
    > main.cpp:(.text.startup+0x5): undefined reference to `mysql_get_client_version'
    > collect2: error: ld returned 1 exit status
    > make: *** [Makefile:67: mysql] Error 1
     => source failed verification.
    Trying source 1 (type mysqlConfig) of library mysql ...
    + /usr/bin/mysql_config --version
    > 10.3.23
    + /usr/bin/mysql_config --libs
    > -L/usr/lib/x86_64-linux-gnu/ -lmariadb
    + /usr/bin/mysql_config --include
    > -I/usr/include/mariadb -I/usr/include/mariadb/mysql
    + cd /mnt/temporanea/Downloads/qt-everywhere-src-5.15.0/config.tests/mysql && /mnt/temporanea/Downloads/qt-everywhere-src-5.15.0/qtbase/bin/qmake "CONFIG -= qt debug_and_release app_bundle lib_bundle" "CONFIG += static warn_off console single_arch" 'QMAKE_USE += mysql' 'QMAKE_LIBS_MYSQL = -L/usr/lib/x86_64-linux-gnu/' 'QMAKE_INCDIR_MYSQL = /usr/include/mariadb /usr/include/mariadb/mysql' /mnt/temporanea/Downloads/qt-everywhere-src-5.15.0/config.tests/mysql
    + cd /mnt/temporanea/Downloads/qt-everywhere-src-5.15.0/config.tests/mysql && MAKEFLAGS= /usr/bin/make clean && MAKEFLAGS= /usr/bin/make
    > rm -f main.o
    > rm -f *~ core *.core
    > g++ -c -pipe -O2 -w -fPIC  -I. -isystem /usr/include/mariadb -isystem /usr/include/mariadb/mysql -I/mnt/temporanea/Downloads/qt-everywhere-src-5.15.0/qtbase/mkspecs/linux-g++ -o main.o main.cpp
    > g++ -Wl,-O1 -o mysql main.o   -L/usr/lib/x86_64-linux-gnu/   
    > /usr/bin/ld: main.o: in function `main':
    > main.cpp:(.text.startup+0x5): undefined reference to `mysql_get_client_version'
    > collect2: error: ld returned 1 exit status
    > make: *** [Makefile:67: mysql] Error 1
     => source failed verification.
    Trying source 2 (type mysqlConfig) of library mysql ...
    + /usr/bin/mysql_config --version
    > 10.3.23
    + /usr/bin/mysql_config --libs_r
    > -L/usr/lib/x86_64-linux-gnu/ -lmariadb
    + /usr/bin/mysql_config --include
    > -I/usr/include/mariadb -I/usr/include/mariadb/mysql
    + cd /mnt/temporanea/Downloads/qt-everywhere-src-5.15.0/config.tests/mysql && /mnt/temporanea/Downloads/qt-everywhere-src-5.15.0/qtbase/bin/qmake "CONFIG -= qt debug_and_release app_bundle lib_bundle" "CONFIG += static warn_off console single_arch" 'QMAKE_USE += mysql' 'QMAKE_LIBS_MYSQL = -L/usr/lib/x86_64-linux-gnu/ -lmariadb' 'QMAKE_INCDIR_MYSQL = /usr/include/mariadb /usr/include/mariadb/mysql' /mnt/temporanea/Downloads/qt-everywhere-src-5.15.0/config.tests/mysql
    + cd /mnt/temporanea/Downloads/qt-everywhere-src-5.15.0/config.tests/mysql && MAKEFLAGS= /usr/bin/make clean && MAKEFLAGS= /usr/bin/make
    > rm -f main.o
    > rm -f *~ core *.core
    > g++ -c -pipe -O2 -w -fPIC  -I. -isystem /usr/include/mariadb -isystem /usr/include/mariadb/mysql -I/mnt/temporanea/Downloads/qt-everywhere-src-5.15.0/qtbase/mkspecs/linux-g++ -o main.o main.cpp
    > g++ -Wl,-O1 -o mysql main.o   -L/usr/lib/x86_64-linux-gnu/ -lmariadb   
     => source accepted.
    
    

    It seems it's looking for different path of mysq_config .



  • @luca install libmysqlclient-dev package


Log in to reply