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

Problems with building the QMYSQL Plugin on Ubuntu 18.04



  • I'm trying to build the plugin using this doc: http://doc.qt.io/Qt-5/sql-driver.html#qmysql.
    After doing first two steps,which are
    1)cd $QTDIR/qtbase/src/plugins/sqldrivers
    2)qmake -- MYSQL_PREFIX=/usr/local
    i'm being stuck on the final one
    3)make sub-mysql
    which throws an error:
    qsql_mysql.cpp: In function ‘QSqlField qToField(MYSQL_FIELD*, QTextCodec*)’:
    qsql_mysql.cpp:333:115: error: no matching function for call to ‘QSqlField::QSqlField(QString, QVariant::Type, QString)’
    ),qDecodeMYSQLType(int(field->type),field->flags),toUnicode(tc, field->table));
    ^
    In file included from qsql_mysql.cpp:46:0:
    /usr/include/x86_64-linux-gnu/qt5/QtSql/qsqlfield.h:60:5: note: candidate: QSqlField::QSqlField(const QSqlField&)
    QSqlField(const QSqlField& other);
    ^~~~~~~~~
    I also have this issue alongside
    $ ldd libqsqlmysql.so
    gives me "libmysqlclient.so.18 => not found" among the text

    Has anybody any suggestions?


  • Lifetime Qt Champion

    Hi and welcome to devnet,

    Which version of MySQL are you using ?
    Did you install the development package of that MySQL version ?



  • Hi, thanks!
    $ mysql -V
    mysql Ver 14.14 Distrib 5.7.22, for Linux (x86_64) using EditLine wrapper
    And the package...I've done this thing:
    $ sudo apt-get install mysql-client libmysqlclient-dev
    But the problem is still present.


  • Lifetime Qt Champion

    I just realised something, is it me or are you trying to build the MySQL plugin using your system provided Qt ?
    You are likely calling the wrong qmake version. Use the full path to it.



  • @SGaist
    I may sound silly, but i don't get it...sorry.
    I used "$ sudo apt install qt5-default" qmake to appear.
    Before the installation i could only get message:
    " qmake: could not find a Qt installation of '' ".

    "$ which qmake" says, that i have only one path (that is used by default) - /usr/bin/qmake
    btw, qmake version is 3.1


  • Lifetime Qt Champion

    In that case, why don't you install the Qt 5 SQL module development package from your distribution ?



  • I also tried "$ sudo apt-get install qtbase5-dev" and "$ make sub-mysql" still says, that mismatching function wants 3 parameters, while it can only take 1 or 2 (depends on which realization is used).


  • Lifetime Qt Champion

    Again: why are you trying to build the plugins for your distribution provided Qt ? Juste install the Qt 5 SQL module and the plugins ?

    Basically: libqt5sql5 and libqt5sql5-mysql


Log in to reply