building Qt MYSQL driver for MAC OS
-
I have been following this post for building my MYSQL driver https://forum.qt.io/topic/135010/building-qt-mysql-driver-for-mac-os-monterey/28
I got to the point where his libraries were built in a /Users/MyUser/Qt/6.6.1/Src/qtbase/src/plugins/sqldrivers/plugins/sqldrivers but I only got /Users/MyUser/Qt/6.6.1/Src/qtbase/src/plugins/sqldrivers.
And cannot find the libqmysql.dylib and libqmysql.dylib.dSYM.
I really don't know what I did wrong.
Here is the command I "built" the mysql driverqt-cmake -G Ninja /Users/boyan/Qt/6.6.1/Src/qtbase/src/plugins/sqldrivers -DCMAKE_INSTALL_PREFIX=/Users/boyan/Qt/6.6.1/macos -DMySQL_INCLUDE_DIR="/usr/local/mysql-8.2.0-macos13-arm64/include" -DMySQL_LIBRARY="/usr/local/mysql-8.2.0-macos13-arm64/lib/libmysqlclient.21.dylib"
-
I have been following this post for building my MYSQL driver https://forum.qt.io/topic/135010/building-qt-mysql-driver-for-mac-os-monterey/28
I got to the point where his libraries were built in a /Users/MyUser/Qt/6.6.1/Src/qtbase/src/plugins/sqldrivers/plugins/sqldrivers but I only got /Users/MyUser/Qt/6.6.1/Src/qtbase/src/plugins/sqldrivers.
And cannot find the libqmysql.dylib and libqmysql.dylib.dSYM.
I really don't know what I did wrong.
Here is the command I "built" the mysql driverqt-cmake -G Ninja /Users/boyan/Qt/6.6.1/Src/qtbase/src/plugins/sqldrivers -DCMAKE_INSTALL_PREFIX=/Users/boyan/Qt/6.6.1/macos -DMySQL_INCLUDE_DIR="/usr/local/mysql-8.2.0-macos13-arm64/include" -DMySQL_LIBRARY="/usr/local/mysql-8.2.0-macos13-arm64/lib/libmysqlclient.21.dylib"
@DeadSo0ul said in building Qt MYSQL driver for MAC OS:
I got to the point where his libraries were built in a /Users/MyUser/Qt/6.6.1/Src/qtbase/src/plugins/sqldrivers/plugins/sqldrivers but I only got /Users/MyUser/Qt/6.6.1/Src/qtbase/src/plugins/sqldrivers.
Hopefully not there but in a build directory
Here is the command I "built" the mysql driver
You did not build anything - you just run cmake to create the build rules. You have to call
ninja
to acutally compile the driver after qt-cmake succeeded. -
@Christian-Ehrlicher
You are correct, thanks!
I did manage to compile the driver withninja
and everything linked. -
S SGaist has marked this topic as solved on
-
I am attempting to compile the MySql plugin without success. Based on what has been posted here previously, I created this command:
/Users/allenkempe/Qt/6.6.1/macos/bin/qt-cmake -G Ninja /Users/allenkempe/Qt/6.6.1/Src/qtbase/src/plugins/sqldrivers -DCMAKE_INSTALL_PREFIX=/Users/allenkempe/Qt/6.6.1/macos -DMySQL_INCLUDE_DIR="/usr/local/opt/mysql-client/include/mysql" -DMySQL_LIBRARY="/usr/local/opt/mysql-client/lib/libmysqlclient.22.dylib"
It appears to configure properly as the summary shows: Qt Sql Drivers: DB2 (IBM) .............................. no InterBase .............................. no MySql .................................. yes OCI (Oracle) ........................... no ODBC ................................... yes PostgreSQL ............................. no SQLite ................................. yes Using system provided SQLite ......... no Mimer .................................. no
-- Configuring done (6.6s)
-- Generating done (0.0s)
-- Build files have been written to: /Users/allenkempe/qt_tempHowever when I run Ninja, I get errors that the Sqlite plugin compile has failed:
l```
ld: Undefined symbols:
QSqlQuery::setForwardOnly(bool) const, referenced from:
QSQLiteDriver::tables(QSql::TableType) const in qsql_sqlite.cpp.o
QSQLiteDriver::primaryIndex(QString const&) const in qsql_sqlite.cpp.o
QSQLiteDriver::record(QString const&) const in qsql_sqlite.cpp.o
clang: error: linker command failed with exit code 1 (use -v to see invocation)
ninja: build stopped: subcommand failed.How can I complile the MySql plugin?
-
Hi, you're building MySql, ODBC and SQLite and the linker step failed for SQLite. But with a bit of luck Ninja managed to build MySql successfully anyway.
@hskoglund yes, it does appear to have compiled. I guess I was misled by the fact that there were no messages about compiling MySql.
allenkempe@Allens-MBP sqldrivers % ls -l
total 952-rwxr-xr-x 1 allenkempe staff 132992 Jan 26 11:36 libqsqlmysql.dylib drwxr-xr-x 3 allenkempe staff 96 Jan 26 11:36 libqsqlmysql.dylib.dSYM -rwxr-xr-x 1 allenkempe staff 348896 Jan 26 11:36 libqsqlodbc.dylib drwxr-xr-x 3 allenkempe staff 96 Jan 26 11:36 libqsqlodbc.dylib.dSYM```
Thanks!
-
Hi, you're building MySql, ODBC and SQLite and the linker step failed for SQLite. But with a bit of luck Ninja managed to build MySql successfully anyway.
@hskoglund I thought I was in fine shape. I moved the new mysql plugin to my Qt's plugins/sqldrivers folder but my program does not recognize it and displays:
1```
5:37:28.790 Warning: QSqlDatabase: QMYSQL3 driver not loaded (:0, (null))
15:37:28.791 Warning: QSqlDatabase: available drivers: QSQLITE QODBC QPSQL (:0, (null))the file is there in Qt/6.6.1.macos/plugins/sqldrivers: allenkempe@Allens-MBP sqldrivers % ls -l total 8232
-rwxr-xr-x@ 1 allenkempe staff 3465760 Nov 17 00:52 libqsqlite.dylib drwxr-xr-x@ 3 allenkempe staff 96 Nov 17 00:52 libqsqlite.dylib.dSYM -rwxr-xr-x@ 1 allenkempe staff 132992 Jan 26 11:36 libqsqlmysql.dylib drwxr-xr-x@ 3 allenkempe staff 96 Jan 26 11:36 libqsqlmysql.dylib.dSYM -rwxr-xr-x@ 1 allenkempe staff 335616 Nov 17 00:52 libqsqlodbc.dylib drwxr-xr-x@ 3 allenkempe staff 96 Nov 17 00:52 libqsqlodbc.dylib.dSYM -rwxr-xr-x@ 1 allenkempe staff 270656 Nov 17 00:52 libqsqlpsql.dylib drwxr-xr-x@ 3 allenkempe staff 96 Nov 17 00:52 libqsqlpsql.dylib.dSYM
-
@hskoglund I thought I was in fine shape. I moved the new mysql plugin to my Qt's plugins/sqldrivers folder but my program does not recognize it and displays:
1```
5:37:28.790 Warning: QSqlDatabase: QMYSQL3 driver not loaded (:0, (null))
15:37:28.791 Warning: QSqlDatabase: available drivers: QSQLITE QODBC QPSQL (:0, (null))the file is there in Qt/6.6.1.macos/plugins/sqldrivers: allenkempe@Allens-MBP sqldrivers % ls -l total 8232
-rwxr-xr-x@ 1 allenkempe staff 3465760 Nov 17 00:52 libqsqlite.dylib drwxr-xr-x@ 3 allenkempe staff 96 Nov 17 00:52 libqsqlite.dylib.dSYM -rwxr-xr-x@ 1 allenkempe staff 132992 Jan 26 11:36 libqsqlmysql.dylib drwxr-xr-x@ 3 allenkempe staff 96 Jan 26 11:36 libqsqlmysql.dylib.dSYM -rwxr-xr-x@ 1 allenkempe staff 335616 Nov 17 00:52 libqsqlodbc.dylib drwxr-xr-x@ 3 allenkempe staff 96 Nov 17 00:52 libqsqlodbc.dylib.dSYM -rwxr-xr-x@ 1 allenkempe staff 270656 Nov 17 00:52 libqsqlpsql.dylib drwxr-xr-x@ 3 allenkempe staff 96 Nov 17 00:52 libqsqlpsql.dylib.dSYM
-
@allenck hi,
Start your application with the QT_DEBUG_PLUGINS environment variable set to 1. That will give you more information about what is happening.
@SGaist said in building Qt MYSQL driver for MAC OS:
QT_DEBUG_PLUGINS
I will try that but I did find that rebooting apparently solved the problem. I did that after cleaning and rebuilding failed to resolve the issue.
Thanks, your quick response is appreciated.