Can't install the qmysql plugin in a Qt setup created using online installer
-
I'm running Qt 5.12.9 in an Ubuntu 18.04, installed it using the online installer wizard. I have selected all the components to install. However, when I want to use the Mysql plugin, it's not available:
unknown: QSqlDatabase: QMYSQL driver not loaded unknown: QSqlDatabase: available drivers: QSQLITE QODBC QODBC3 QPSQL QPSQL7 QSQLCIPHER
When Is -l the /usr/local/Qt/5.12.9/gcc_64/plugins/sqldrivers folder I see other plugins that the installer created:
-rwxr-xr-x 1 root root 1280368 Jun 11 2020 libqsqlite.so -rwxr-xr-x 1 root root 119352 Jun 11 2020 libqsqlodbc.so -rwxr-xr-x 1 root root 112440 Jun 11 2020 libqsqlpsql.so
However, the libqmysql.so file isn't being created. Reading the docs, it seems I need to do a qmake in this directory to create it, but shouldn't a .pro file be required for this? Do I need to build the whole qt project for this instead of using the installer?
-
I'm running Qt 5.12.9 in an Ubuntu 18.04, installed it using the online installer wizard. I have selected all the components to install. However, when I want to use the Mysql plugin, it's not available:
unknown: QSqlDatabase: QMYSQL driver not loaded unknown: QSqlDatabase: available drivers: QSQLITE QODBC QODBC3 QPSQL QPSQL7 QSQLCIPHER
When Is -l the /usr/local/Qt/5.12.9/gcc_64/plugins/sqldrivers folder I see other plugins that the installer created:
-rwxr-xr-x 1 root root 1280368 Jun 11 2020 libqsqlite.so -rwxr-xr-x 1 root root 119352 Jun 11 2020 libqsqlodbc.so -rwxr-xr-x 1 root root 112440 Jun 11 2020 libqsqlpsql.so
However, the libqmysql.so file isn't being created. Reading the docs, it seems I need to do a qmake in this directory to create it, but shouldn't a .pro file be required for this? Do I need to build the whole qt project for this instead of using the installer?
@Aritz said in Can't install the qmysql plugin in a Qt setup created using online installer:
Reading the docs, it seems I need to do a qmake in this directory
You need to do it in source code directory for QMysql driver. Follow https://doc.qt.io/qt-5/sql-driver.html ("Compile only a specific sql driver").
-
I see, but when I run either qmake -- MYSQL_PREFIX=/usr/local or qmake -- MYSQL_PREFIX=/usr/local/mysql in the sqldrivers folder I get:
Usage: 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 -Wdeprecated Turn on deprecation warnings (on by default) Options: * You can place any variable assignment in options and it will be * * processed as if it was in [files]. These assignments will be * * processed before [files] by default. * -o file Write output to file -d Increase debug level -t templ Overrides TEMPLATE as templ -tp prefix Overrides TEMPLATE so that prefix is prefixed into the value -help This help -v Version information -early All subsequent variable assignments will be parsed right before default_pre.prf -before All subsequent variable assignments will be parsed right before [files] (the default) -after All subsequent variable assignments will be parsed after [files] -late All subsequent variable assignments will be parsed right after default_post.prf -norecursive Don't do a recursive search -recursive Do a recursive search -set <prop> <value> Set persistent property -unset <prop> Unset persistent property -query <prop> Query persistent property. Show all if <prop> is empty. -qtconf file Use file instead of looking for qt.conf -cache file Use file as cache [makefile mode only] -spec spec Use spec as QMAKESPEC [makefile mode only] -nocache Don't use a cache file [makefile mode only] -nodepend Don't generate dependencies [makefile mode only] -nomoc Don't generate moc targets [makefile mode only] -nopwd Don't look for files in pwd [project mode only]
-
I see, but when I run either qmake -- MYSQL_PREFIX=/usr/local or qmake -- MYSQL_PREFIX=/usr/local/mysql in the sqldrivers folder I get:
Usage: 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 -Wdeprecated Turn on deprecation warnings (on by default) Options: * You can place any variable assignment in options and it will be * * processed as if it was in [files]. These assignments will be * * processed before [files] by default. * -o file Write output to file -d Increase debug level -t templ Overrides TEMPLATE as templ -tp prefix Overrides TEMPLATE so that prefix is prefixed into the value -help This help -v Version information -early All subsequent variable assignments will be parsed right before default_pre.prf -before All subsequent variable assignments will be parsed right before [files] (the default) -after All subsequent variable assignments will be parsed after [files] -late All subsequent variable assignments will be parsed right after default_post.prf -norecursive Don't do a recursive search -recursive Do a recursive search -set <prop> <value> Set persistent property -unset <prop> Unset persistent property -query <prop> Query persistent property. Show all if <prop> is empty. -qtconf file Use file instead of looking for qt.conf -cache file Use file as cache [makefile mode only] -spec spec Use spec as QMAKESPEC [makefile mode only] -nocache Don't use a cache file [makefile mode only] -nodepend Don't generate dependencies [makefile mode only] -nomoc Don't generate moc targets [makefile mode only] -nopwd Don't look for files in pwd [project mode only]
-
The sub rule still doesn't seem to be created:
+ cd /usr/local/Qt/5.12.9/Src/qtbase/src/plugins/sqldrivers + qmake -- MYSQL_PREFIX=/usr/local Info: creating stash file /usr/local/Qt/5.12.9/Src/qtbase/src/plugins/sqldrivers/.qmake.stash Done running configuration tests. Configure summary: Qt Sql Drivers: DB2 (IBM) .............................. no InterBase .............................. no MySql .................................. no 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 '/usr/local/Qt/5.12.9/gcc_64'. Prior to reconfiguration, make sure you remove any leftovers from the previous build. + make sub-mysql make: *** No rule to make target 'sub-mysql'. Stop.
-
The sub rule still doesn't seem to be created:
+ cd /usr/local/Qt/5.12.9/Src/qtbase/src/plugins/sqldrivers + qmake -- MYSQL_PREFIX=/usr/local Info: creating stash file /usr/local/Qt/5.12.9/Src/qtbase/src/plugins/sqldrivers/.qmake.stash Done running configuration tests. Configure summary: Qt Sql Drivers: DB2 (IBM) .............................. no InterBase .............................. no MySql .................................. no 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 '/usr/local/Qt/5.12.9/gcc_64'. Prior to reconfiguration, make sure you remove any leftovers from the previous build. + make sub-mysql make: *** No rule to make target 'sub-mysql'. Stop.
-
Hi,
One more thing, ensure that you are using the qmake executable matching your Qt version for which you want to build the driver for.