Error while compiling Qt mySQL driver
-
@tntneo said in Error while compiling Qt mySQL driver:
libmysqlclient18
-
Hi guys,
I've same issue although I already installed
libmysqlclient20
andlibmysqlclient-dev
and run:
sudo ln -s /usr/lib/x86_64-linux-gnu/libmysqlclient.so /usr/lib/x86_64-linux-gnu/libmysqlclient_r.so
as mentioned here:May I get some help here.
Thanks in advance.
I'm using:
- Qt 5.9.1
- MySQL 5.7.18
- Linux Mint 18.2 x64 xfce (Ubuntu 16.04)
log
$ /home/mogla/.Qt/5.9.1/gcc_64/bin/qmake Cannot read /home/mogla/.Qt/5.9.1/Src/qtbase/src/plugins/sqldrivers/qtsqldrivers-config.pri: No such file or directory $ ls /home/mogla/.Qt/5.9.1/Src/qtbase/src/plugins/sqldrivers/ configure.json configure.pri db2 ibase lib mkspecs mysql oci odbc plugins psql qsqldriverbase.pri README sqldrivers.pro sqlite sqlite2 tds $
IMPORTANT:
This issue occurs with Qt 5.9.1 while doesn't with Qt 5.8! -
Hi,
Looks like it's a generated file however I don't know yet exactly how it is generated.
In between, you can try to use that one:
QT.sqldrivers.enabled_features = QT.sqldrivers.disabled_features = QT.sqldrivers.QT_CONFIG = QT.sqldrivers.exports = QT.sqldrivers_private.enabled_features = sql-sqlite sql-mysql QT.sqldrivers_private.disabled_features = sql-db2 sql-ibase sql-oci sql-odbc sql-psql sql-sqlite2 sql-tds system-sqlite QT.sqldrivers_private.libraries =
It's based on one of my builds.
-
@SGaist said in Error while compiling Qt mySQL driver:
Hi,
Looks like it's a generated file however I don't know yet exactly how it is generated.
In between, you can try to use that one:
QT.sqldrivers.enabled_features = QT.sqldrivers.disabled_features = QT.sqldrivers.QT_CONFIG = QT.sqldrivers.exports = QT.sqldrivers_private.enabled_features = sql-sqlite sql-mysql QT.sqldrivers_private.disabled_features = sql-db2 sql-ibase sql-oci sql-odbc sql-psql sql-sqlite2 sql-tds system-sqlite QT.sqldrivers_private.libraries =
It's based on one of my builds.
Where can I use these configs?!
-
That's the content of the generated
qtsqldrivers-config.pri
I have. -
@SGaist said in Error while compiling Qt mySQL driver:
Hi,
Looks like it's a generated file however I don't know yet exactly how it is generated.
In between, you can try to use that one:
QT.sqldrivers.enabled_features = QT.sqldrivers.disabled_features = QT.sqldrivers.QT_CONFIG = QT.sqldrivers.exports = QT.sqldrivers_private.enabled_features = sql-sqlite sql-mysql QT.sqldrivers_private.disabled_features = sql-db2 sql-ibase sql-oci sql-odbc sql-psql sql-sqlite2 sql-tds system-sqlite QT.sqldrivers_private.libraries =
It's based on one of my builds.
I created a new file depending on yours.
qmake
done fine whilemake
gave me this error:$ make g++ -c -pipe -O2 -std=c++1z -fvisibility=hidden -fvisibility-inlines-hidden -fno-exceptions -Wall -W -Wvla -Wdate-time -D_REENTRANT -fPIC -DQT_NO_NARROWING_CONVERSIONS_IN_CONNECT -DQT_NO_CAST_TO_ASCII -DQT_NO_CAST_FROM_ASCII -DQT_NO_EXCEPTIONS -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -DQT_NO_DEBUG -DQT_PLUGIN -DQT_SQL_LIB -DQT_CORE_LIB -I. -I/home/mbnoimi/.Qt/5.9.1/gcc_64/include/QtSql/5.9.1 -I/home/mbnoimi/.Qt/5.9.1/gcc_64/include/QtSql/5.9.1/QtSql -I/home/mbnoimi/.Qt/5.9.1/gcc_64/include/QtCore/5.9.1 -I/home/mbnoimi/.Qt/5.9.1/gcc_64/include/QtCore/5.9.1/QtCore -I/home/mbnoimi/.Qt/5.9.1/gcc_64/include -I/home/mbnoimi/.Qt/5.9.1/gcc_64/include/QtSql -I/home/mbnoimi/.Qt/5.9.1/gcc_64/include/QtCore -I.moc -I/home/mbnoimi/.Qt/5.9.1/gcc_64/mkspecs/linux-g++ -o .obj/qsql_mysql.o qsql_mysql.cpp In file included from qsql_mysql.cpp:40:0: qsql_mysql_p.h:60:19: fatal error: mysql.h: No such file or directory compilation terminated. Makefile:773: recipe for target '.obj/qsql_mysql.o' failed make: *** [.obj/qsql_mysql.o] Error 1 $
-
The build system has changed so it looks rather like a documentation bug.
-
Qt plugins really pain in the ass... I'm very frustrated!!!
It seems I've to rollback to Microsoft products after years of using Qt. Because of this stupid policy of Qt I always spend hours and hours on deployment or building a stupid plugin which suppose to be available in the binary distro!!!
Why the developer needs to rebuild anything from source code if he/she chose to use binary distro of Qt!!!
Any way, I filed a bug report about this stupid bug in this link:
https://bugreports.qt.io/browse/QTBUG-62078For whom concern:
https://forum.qt.io/topic/81272/licenses-craziness -
Have you qMake it?
-
@Eduardo12l Yes
-
@All, You do not really need to rebuild the plugin! I guess you may get same error even after recompile.
Why: from the output, Qt creator, does not say there is any problem with QMYSQL, everything seems to be OK, except linking to the correct driver/lib, best to do is to try these steps first of all:- download the 32-bit version of mysql connector/c from:
libmysql 32 bit version
on Linux/Mac we get (mysql-connector-c-6.0.2-osx10.5-x86-32bit.tar) - untar, and install the package (with defaults), you should get the driver installed at :
/usr/local/mysql-connector-c-6.0.2-osx10.5-x86-32bit/lib/libmysql.dylib - Then copy it to your build folder ( <your Base Qt location>/5.9.1/clang_64/bin) ... for test -> rebuild your solution and should not show that error again, plus, database connectivity should work.
if it works then, instead of keeping the copied library at the qt bin directory, best is to remove it and add library to your project: - delete the file you copied to clang_64/bin .
- in your project add library pointing to the downloaded 32 bit libmysql.dll (right click -> add library -> external)
(adding as library is suitable later for deployment).
- download the 32-bit version of mysql connector/c from:
-
Thanks a lot @Mohammad-Kanan your solution worked but I used
mysql-connector-c-6.1.11-linux-glibc2.12-x86_64
instead of32 bit
versionI struggled with this issue for 15 days then I surrendered
-
Hi I had the same problem with qtsqldrivers-config.pri
I leave it here, maybe it will be helpful
Go to :
/Qt_new/5.9.1/Src/qtbase/src/plugins/sqldrivers
Run qmake:
../../../../../gcc_64/bin/qmake sqldrivers.pro
After that I got:Configure summary:
Qt Sql:
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) ........................... noThen go to:
/Qt_new/5.9.1/Src/qtbase/src/plugins/sqldrivers/mysql
Run qmake again:
../../../../../../gcc_64/bin/qmake mysql.pro
Run make:
make
You will see as a part of an output message that it was compiled and moved into:
"mv -f libqsqlmysql.so ../plugins/sqldrivers/" -
@chrabaszcz.patryk said in Error while compiling Qt mySQL driver:
Hi I had the same problem with qtsqldrivers-config.pri
I leave it here, maybe it will be helpful
Go to :
/Qt_new/5.9.1/Src/qtbase/src/plugins/sqldrivers
Run qmake:
../../../../../gcc_64/bin/qmake sqldrivers.pro
After that I got:Configure summary:
Qt Sql:
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) ........................... noThen go to:
/Qt_new/5.9.1/Src/qtbase/src/plugins/sqldrivers/mysql
Run qmake again:
../../../../../../gcc_64/bin/qmake mysql.pro
Run make:
make
You will see as a part of an output message that it was compiled and moved into:
"mv -f libqsqlmysql.so ../plugins/sqldrivers/"I try to solve this problem for the whole night,your solution saved me.Solve the problem perfectly. Thanks very much.Thanks .
-
Hi I had the same problem with qtsqldrivers-config.pri
I leave it here, maybe it will be helpful
Go to :
/Qt_new/5.9.1/Src/qtbase/src/plugins/sqldrivers
Run qmake:
../../../../../gcc_64/bin/qmake sqldrivers.pro
After that I got:Configure summary:
Qt Sql:
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) ........................... noThen go to:
/Qt_new/5.9.1/Src/qtbase/src/plugins/sqldrivers/mysql
Run qmake again:
../../../../../../gcc_64/bin/qmake mysql.pro
Run make:
make
You will see as a part of an output message that it was compiled and moved into:
"mv -f libqsqlmysql.so ../plugins/sqldrivers/"I had this problem when added Qt 5.13.0 using online installation to the Qt 5.12 i have already installed i thought the installation was wrong until i came across your solution. Thanks you very much.
-
@chrabaszcz-patryk Registered here to thank you for your useful message :)
This problem is still actual in 5.15.0. Solved it as you mentioned.
-
@chrabaszcz-patryk Confirming this works, was trying to install ODBC and had the same error as OP. Did the suggested steps by @chrabaszcz-patryk and it worked on Qt 5.11.3 on Rpi 4B.