I'm trying to install the QMYSQL driver on Ubuntu 24.04 LTS with Qt version 5.15.3, but I'm running into some issues.
Problem:
The sqldrivers directory only contains the SQLite driver, and I'm missing the QMYSQL driver.
Paths:
- qmake: /usr/lib/x86_64-linux-gnu/qt5/bin/qmake
- sqldrivers: /usr/lib/x86_64-linux-gnu/qt5/plugins/sqldrivers
- libmysqlclient.so.21.2.37: /usr/lib/x86_64-linux-gnu/libmysqlclient.so.21.2.37
- MySQL headers: /usr/include/mysql
Steps Taken:
- Installed necessary dependencies: sudo apt install libmysqlclient-dev
- Tried the following commands:
bash cd $QTDIR/qtbase/src/plugins/sqldrivers qmake -- MYSQL_PREFIX=/usr/local make sub-mysql
Output:
/usr/lib/x86_64-linux-gnu/qt5/plugins/sqldrivers$ qmake -- MYSQL_PREFIX=/usr/include/mysql Usage: /usr/lib/qt5/bin/qmake [mode] [options] [files]
QMake has two modes, one mode for generating project files based on some heuristics, and the other for generating makefiles. Normally you shouldn't need to specify a mode, as makefile generation is the default mode for qmake, but you may use this to test qmake on an existing project
[...]
and:
make: *** There is no rule to build target "sub-mysql". Stop.
How do I solve this problem and install the QMYSQL driver?