Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Issue compiling mysql driver...
mbruel last edited by
I've managed to compile the driver and use it on my laptop where I installed QT with the online installer.
I downloaded the source qtbase-opensource-src-5.5.1.tar.gz and used
/opt/Qt5.5.1/5.5/gcc/bin/qmake "INCLUDEPATH+=/usr/include" "LIBS+=-L/usr/lib/i386-linux-gnu -lmysqlclient_r" mysql.pro make
I'm trying now to compile it on a remote server where QT was installed with the packet manager (debian jessie).
As qmake -version return 5.3.2, I've downloaded the source of that version: qtbase-opensource-src-5.3.2.tar.gz and trying to do the same:
~/tmp/qtbase-opensource-src-5.3.2/src/plugins/sqldrivers/mysql$ qmake "INCLUDEPATH+=/usr/include""LIBS+=-L/usr/lib/x86_64-linux-gnu -lmysqlclient_r" mysql.pro ~/tmp/qtbase-opensource-src-5.3.2/src/plugins/sqldrivers/mysql$ make g++ -c -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -I/usr/include/mysql -O2 -fvisibility=hidden -fvisibility-inlines-hidden -std=c++0x -fno-exceptions -Wall -W -D_REENTRANT -fPIC -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../../../../mkspecs/linux-g++-64 -I. -isystem /usr/include -I../../../../src -isystem /usr/include/x86_64-linux-gnu/qt5/QtSql/5.3.2 -isystem /usr/include/x86_64-linux-gnu/qt5/QtSql/5.3.2/QtSql -isystem /usr/include/x86_64-linux-gnu/qt5 -isystem /usr/include/x86_64-linux-gnu/qt5/QtSql -isystem /usr/include/x86_64-linux-gnu/qt5/QtCore/5.3.2 -isystem /usr/include/x86_64-linux-gnu/qt5/QtCore/5.3.2/QtCore -isystem /usr/include/x86_64-linux-gnu/qt5/QtCore -I.moc -o .obj/qsql_mysql.o ../../../sql/drivers/mysql/qsql_mysql.cpp ../../../sql/drivers/mysql/qsql_mysql.cpp:44:40: fatal error: QtSql/private/qsqldriver_p.h: No such file or directory #include <QtSql/private/qsqldriver_p.h> ^ compilation terminated. Makefile:379: recipe for target '.obj/qsql_mysql.o' failed make: *** [.obj/qsql_mysql.o] Error 1
it seems there are no qsqldriver_p.h in my /usr/include/x86_64-linux-gnu/qt5/.
Any idea why?
The only place I find it is in the source folder: ~/tmp/qtbase-opensource-src-5.3.2/src/sql/kernel/qsqldriver_p.h
PS: I checked in my lib folder to see which database drivers I have and there is only sqllite so I'll definitely need to compile the mysql one.
Do I understand you correctly: you are trying to build the Qt MySQL driver using the distribution provided Qt ? If so, why ? Your distribution should also provide you with pre-compiled Qt SQL drivers
mbruel last edited by
You're understanding correctly...
Well I just had to build it on my laptop for QT 5.51 because the current version of the driver wasn't working with mysql 5.5. It was quite a simple process...
I wanted to try my program on a remote server, noticed the driver wasn't present at all, so just thought I'll build it myself to be sure it will be compatible with the version of mysql installed.
You're right, I've found the package in my distribution and it is working well. (libqt5sql5-mysql on debian jessie)