0

I build the QMYSQL drivers, but when I run my program this error appears:

QSqlDatabase: QMYSQL driver not loaded
QSqlDatabase: available drivers: 

Here is path to were my so files has been compiled :

/home/uia53314/Qt5.13.0/5.13.0/Src/qtbase/src/plugins/sqldrivers/plugins/sqldrivers
 ls :
libqsqlite.so  libqsqlite.so.debug  libqsqlmysql.so  libqsqlmysql.so.debug


 /Qt5.13.0/5.13.0/Src/qtbase/src/plugins/sqldrivers$ ls:


config.cache    libqsqlite.so          psql
config.log      libqsqlite.so.debug    qsqldriverbase.pri
config.opt      libqsqlmysql.so        qtsqldrivers-config.h
config.summary  libqsqlmysql.so.debug  qtsqldrivers-config_p.h
config.tests    Makefile               qtsqldrivers-config.pri
configure.json  mkspecs                README
configure.pri   mysql                  sqldrivers.pro
db2             oci                    sqlite
ibase           odbc                   sqlite2
lib             plugins                tds

Running the qmake sqldrivers.pro in /Qt5.13.0/5.13.0/Src/qtbase/src/plugins/sqldrivers give me :

Configure summary:

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

Qt is now configured for building. Just run 'make'.
Once everything is built, you must run 'make install'.
Qt will be installed into '/home/uia53314/Qt5.13.0/5.13.0/gcc_64'.

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

Is something that I need to add in my profile to make the program see the drivers :

greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
QT       += core gui charts sql

TARGET = WebmPlayer
TEMPLATE = app
CONFIG += c++11


QTPLUGIN += qsqlmysql

DEFINES += QT_DEPRECATED_WARNINGS


#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000    # disables all the APIs deprecated before Qt 6.0.0


TEMPLATE = app

INCLUDEPATH += /usr/local/include/
LIBS += -L/usr/local/lib  -lcurlpp -lcurl
LIBS += -L/usr/local/lib/x86_64-linux-gnu  -lmysqlclient

CONFIG += console link_pkgconfig
#CONFIG -= app_bundle qt

PKGCONFIG += vpx opus vorbis

INCLUDEPATH = . libwebm
DEPENDPATH  = . libwebm
Ðаn
  • 10,934
  • 11
  • 59
  • 95
  • what is the output of `ldd /home/uia53314/Qt5.13.0/5.13.0/Src/qtbase/src/plugins/sqldrivers/plugins/sqldrivers/libqsqlmysql.so` and remove `LIBS += -L/usr/local/lib/x86_64-linux-gnu -lmysqlclient ` – eyllanesc Mar 24 '20 at 20:28
  • Also execute your program with: `QT_DEBUG_PLUGINS=1 ./your_executable` – eyllanesc Mar 24 '20 at 20:29
  • After qmake did you run `make && make install`? – eyllanesc Mar 24 '20 at 20:30
  • here is my ldd output : ldd libqsqlmysql.so ./libqsqlmysql.so: /usr/lib/x86_64-linux-gnu/libQt5Sql.so.5: version `Qt_5_PRIVATE_API' not found (required by ./libqsqlmysql.so) ./libqsqlmysql.so: /usr/lib/x86_64-linux-gnu/libQt5Sql.so.5: version `Qt_5' not found (required by ./libqsqlmysql.so) ./libqsqlmysql.so: /usr/lib/libQt5Core.so.5: version `Qt_5.13' not found (required by ./libqsqlmysql.so) @eyllanesc – Silviu Petrut Mar 25 '20 at 07:52
  • It seems that you have a default Qt in your OS and you have compiled the plugin with that Qt, do not use `qmake` but `/home/uia53314/Qt5.13.0/5.13.0/gcc_64/bin/qmake` when you compile the plugin – eyllanesc Mar 25 '20 at 07:56

0 Answers0