Problème d'installation du driver QMySql
-
@hskoglund hi dude, I'm sorry to disturb you.
do you have any idea why qt-cmake is not working ? -
a big thank, you really are a really great help
now I have another problem with the build doesn’t end (story for copy this big block) :melvin_vga@melvins-macbook-pro build-sqldrivers % cmake --build .
[8/11] Linking CXX shared module plugins/sqldrivers/libqsqlmysql.dylib
FAILED: plugins/sqldrivers/libqsqlmysql.dylib
: && /usr/bin/clang++ -g -DNDEBUG -O2 -arch x86_64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.1.sdk -mmacosx-version-min=10.14 -bundle -Wl,-headerpad_max_install_names -Wl,-undefined,error -fapplication-extension -o plugins/sqldrivers/libqsqlmysql.dylib mysql/CMakeFiles/QMYSQLDriverPlugin.dir/QMYSQLDriverPlugin_autogen/mocs_compilation.cpp.o mysql/CMakeFiles/QMYSQLDriverPlugin.dir/main.cpp.o mysql/CMakeFiles/QMYSQLDriverPlugin.dir/qsql_mysql.cpp.o -Wl,-rpath,/usr/local/mysql/lib -Wl,-rpath,/Users/melvin_vga/Qt/6.2.3/macos/lib /usr/local/mysql/lib/libmysqlclient.dylib /Users/melvin_vga/Qt/6.2.3/macos/lib/QtSql.framework/Versions/A/QtSql /Users/melvin_vga/Qt/6.2.3/macos/lib/QtCore.framework/Versions/A/QtCore -framework DiskArbitration -framework IOKit && cd /Users/melvin_vga/build-sqldrivers/mysql && /opt/homebrew/Cellar/cmake/3.22.3/bin/cmake -E make_directory /Users/melvin_vga/build-sqldrivers/plugins/sqldrivers/libqsqlmysql.dylib.dSYM/Contents/Resources/DWARF && /opt/homebrew/Cellar/cmake/3.22.3/bin/cmake -E copy Info.dSYM.plist /Users/melvin_vga/build-sqldrivers/plugins/sqldrivers/libqsqlmysql.dylib.dSYM/Contents/Info.plist && /usr/bin/dsymutil /Users/melvin_vga/build-sqldrivers/plugins/sqldrivers/libqsqlmysql.dylib --flat -o /Users/melvin_vga/build-sqldrivers/plugins/sqldrivers/libqsqlmysql.dylib.dSYM/Contents/Resources/DWARF/qsqlmysql && /usr/bin/strip -S /Users/melvin_vga/build-sqldrivers/plugins/sqldrivers/libqsqlmysql.dylib && chmod -x /Users/melvin_vga/build-sqldrivers/plugins/sqldrivers/libqsqlmysql.dylib.dSYM/Contents/Resources/DWARF/qsqlmysql
ld: warning: ignoring file /usr/local/mysql/lib/libmysqlclient.dylib, building for macOS-x86_64 but attempting to link with file built for macOS-arm64
Undefined symbols for architecture x86_64:
"_mysql_affected_rows", referenced from:
QMYSQLResult::reset(QString const&) in qsql_mysql.cpp.o
QMYSQLResult::nextResult() in qsql_mysql.cpp.o
"_mysql_character_set_name", referenced from:
QMYSQLDriver::open(QString const&, QString const&, QString const&, QString const&, int, QString const&) (.cold.1) in qsql_mysql.cpp.o
"_mysql_close", referenced from:
QMYSQLDriver::open(QString const&, QString const&, QString const&, QString const&, int, QString const&) in qsql_mysql.cpp.o
QMYSQLDriver::close() in qsql_mysql.cpp.o
"_mysql_data_seek", referenced from:
QMYSQLResult::fetch(int) in qsql_mysql.cpp.o
"_mysql_errno", referenced from:
qMakeError(QString const&, QSqlError::ErrorType, QMYSQLDriverPrivate const*) in qsql_mysql.cpp.o
QMYSQLResult::record() const in qsql_mysql.cpp.o
"_mysql_error", referenced from:
qMakeError(QString const&, QSqlError::ErrorType, QMYSQLDriverPrivate const*) in qsql_mysql.cpp.o
QMYSQLDriver::open(QString const&, QString const&, QString const&, QString const&, int, QString const&) (.cold.1) in qsql_mysql.cpp.o
"_mysql_fetch_field", referenced from:
QMYSQLResultPrivate::bindInValues() in qsql_mysql.cpp.o
QMYSQLResult::record() const in qsql_mysql.cpp.o
QMYSQLDriver::record(QString const&) const in qsql_mysql.cpp.o
"_mysql_fetch_field_direct", referenced from:
QMYSQLResult::reset(QString const&) in qsql_mysql.cpp.o
QMYSQLResult::nextResult() in qsql_mysql.cpp.o
"_mysql_fetch_lengths", referenced from:
QMYSQLResult::data(int) in qsql_mysql.cpp.o
"_mysql_fetch_row", referenced from:
QMYSQLResult::fetch(int) in qsql_mysql.cpp.o
QMYSQLResult::fetchNext() in qsql_mysql.cpp.o
"_mysql_field_count", referenced from:
QMYSQLResult::reset(QString const&) in qsql_mysql.cpp.o
QMYSQLResult::nextResult() in qsql_mysql.cpp.o
"_mysql_field_seek", referenced from:
QMYSQLResult::record() const in qsql_mysql.cpp.o
"_mysql_free_result", referenced from:
QMYSQLResult::cleanup() in qsql_mysql.cpp.o
QMYSQLResult::nextResult() in qsql_mysql.cpp.o
QMYSQLDriver::record(QString const&) const in qsql_mysql.cpp.o
"_mysql_init", referenced from:
QMYSQLDriver::open(QString const&, QString const&, QString const&, QString const&, int, QString const&) in qsql_mysql.cpp.o
"_mysql_insert_id", referenced from:
QMYSQLResult::lastInsertId() const in qsql_mysql.cpp.o
"_mysql_list_fields", referenced from:
QMYSQLDriver::record(QString const&) const in qsql_mysql.cpp.o
"_mysql_next_result", referenced from:
QMYSQLResult::cleanup() in qsql_mysql.cpp.o
QMYSQLResult::nextResult() in qsql_mysql.cpp.o
"_mysql_num_fields", referenced from:
QMYSQLResultPrivate::bindInValues() in qsql_mysql.cpp.o
"_mysql_num_rows", referenced from:
QMYSQLResult::fetchLast() in qsql_mysql.cpp.o
QMYSQLResult::size() in qsql_mysql.cpp.o
"_mysql_options", referenced from:
QMYSQLDriver::open(QString const&, QString const&, QString const&, QString const&, int, QString const&) in qsql_mysql.cpp.o
"_mysql_query", referenced from:
QMYSQLDriver::beginTransaction() in qsql_mysql.cpp.o
QMYSQLDriver::commitTransaction() in qsql_mysql.cpp.o
QMYSQLDriver::rollbackTransaction() in qsql_mysql.cpp.o
"_mysql_real_connect", referenced from:
QMYSQLDriver::open(QString const&, QString const&, QString const&, QString const&, int, QString const&) in qsql_mysql.cpp.o
"_mysql_real_escape_string", referenced from:
QMYSQLDriver::formatValue(QSqlField const&, bool) const in qsql_mysql.cpp.o
"_mysql_real_query", referenced from:
QMYSQLResult::reset(QString const&) in qsql_mysql.cpp.o
"_mysql_select_db", referenced from:
QMYSQLDriver::open(QString const&, QString const&, QString const&, QString const&, int, QString const&) in qsql_mysql.cpp.o
"_mysql_server_end", referenced from:
QMYSQLDriver::~QMYSQLDriver() in qsql_mysql.cpp.o
QMYSQLDriver::~QMYSQLDriver() in qsql_mysql.cpp.o
QMYSQLDriver::~QMYSQLDriver() in qsql_mysql.cpp.o
"_mysql_server_init", referenced from:
QMYSQLDriver::QMYSQLDriver(QObject*) in qsql_mysql.cpp.o
QMYSQLDriver::QMYSQLDriver(MYSQL*, QObject*) in qsql_mysql.cpp.o
"_mysql_set_character_set", referenced from:
QMYSQLDriver::open(QString const&, QString const&, QString const&, QString const&, int, QString const&) in qsql_mysql.cpp.o
"_mysql_ssl_set", referenced from:
QMYSQLDriver::open(QString const&, QString const&, QString const&, QString const&, int, QString const&) in qsql_mysql.cpp.o
"_mysql_stmt_affected_rows", referenced from:
QMYSQLResult::exec() in qsql_mysql.cpp.o
"_mysql_stmt_attr_set", referenced from:
QMYSQLResult::exec() in qsql_mysql.cpp.o
"_mysql_stmt_bind_param", referenced from:
QMYSQLResult::exec() in qsql_mysql.cpp.o
"_mysql_stmt_bind_result", referenced from:
QMYSQLResult::exec() in qsql_mysql.cpp.o
"_mysql_stmt_close", referenced from:
QMYSQLResult::cleanup() in qsql_mysql.cpp.o
QMYSQLDriver::open(QString const&, QString const&, QString const&, QString const&, int, QString const&) in qsql_mysql.cpp.o
"_mysql_stmt_data_seek", referenced from:
QMYSQLResult::fetch(int) in qsql_mysql.cpp.o
"_mysql_stmt_errno", referenced from:
qMakeStmtError(QString const&, QSqlError::ErrorType, MYSQL_STMT*) in qsql_mysql.cpp.o
"_mysql_stmt_error", referenced from:
qMakeStmtError(QString const&, QSqlError::ErrorType, MYSQL_STMT*) in qsql_mysql.cpp.o
"_mysql_stmt_execute", referenced from:
QMYSQLResult::exec() in qsql_mysql.cpp.o
"_mysql_stmt_fetch", referenced from:
QMYSQLResult::fetch(int) in qsql_mysql.cpp.o
QMYSQLResult::fetchNext() in qsql_mysql.cpp.o
"_mysql_stmt_free_result", referenced from:
QMYSQLResult::detachFromResultSet() in qsql_mysql.cpp.o
"_mysql_stmt_init", referenced from:
QMYSQLResult::prepare(QString const&) in qsql_mysql.cpp.o
QMYSQLDriver::open(QString const&, QString const&, QString const&, QString const&, int, QString const&) in qsql_mysql.cpp.o
"_mysql_stmt_insert_id", referenced from:
QMYSQLResult::lastInsertId() const in qsql_mysql.cpp.o
"_mysql_stmt_num_rows", referenced from:
QMYSQLResult::fetchLast() in qsql_mysql.cpp.o
QMYSQLResult::size() in qsql_mysql.cpp.o
"_mysql_stmt_param_count", referenced from:
QMYSQLResult::prepare(QString const&) in qsql_mysql.cpp.o
QMYSQLResult::exec() in qsql_mysql.cpp.o
QMYSQLDriver::open(QString const&, QString const&, QString const&, QString const&, int, QString const&) in qsql_mysql.cpp.o
"_mysql_stmt_prepare", referenced from:
QMYSQLResult::prepare(QString const&) in qsql_mysql.cpp.o
QMYSQLDriver::open(QString const&, QString const&, QString const&, QString const&, int, QString const&) in qsql_mysql.cpp.o
"_mysql_stmt_reset", referenced from:
QMYSQLResult::exec() in qsql_mysql.cpp.o
"_mysql_stmt_result_metadata", referenced from:
QMYSQLResultPrivate::bindInValues() in qsql_mysql.cpp.o
"_mysql_stmt_store_result", referenced from:
QMYSQLResult::exec() in qsql_mysql.cpp.o
"_mysql_store_result", referenced from:
QMYSQLResult::cleanup() in qsql_mysql.cpp.o
QMYSQLResult::reset(QString const&) in qsql_mysql.cpp.o
QMYSQLResult::nextResult() in qsql_mysql.cpp.o
"_mysql_thread_end", referenced from:
QMYSQLDriver::close() in qsql_mysql.cpp.o
"_mysql_thread_init", referenced from:
QMYSQLDriver::open(QString const&, QString const&, QString const&, QString const&, int, QString const&) in qsql_mysql.cpp.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
[10/11] Building C object sqlite/CMakeFiles/QSQLiteDriverPlugin.dir/Users/melvin_vga/Qt/6.2.3/Src/qtbase/src/3rdparty/sqlite/sqlite3.c.o
ninja: build stopped: subcommand failed. -
Hi, every program from Apple like Xcode etc. or Qt Creator or iQt 6.2.3 (installed by the MaintenanceTool) can be run both on an old Intel-based Apple PC or a new ARM-based M1 or M2 Apple PC, since they are universal binaries, you can check it with the file command, for example try it on the SQLite dylib which MaintenanceTool installs for you):
file ~/Qt/6.2.3/macos/plugins/sqldrivers/libqsqlite.dylib
But Homebrew does not like this idea so you have to be careful on which type of Apple PC you install MySQL on. You get a linker error because MySQL from Homebrew seems built only for arm64 (M1 or M2 PCs) but you are building the libqmysql.dylib plugin for an x86_64 Intel Apple PC.
If you want to build the plugin for an arm64 Apple PC you can try to override it in your qt-cmake command with a CMAKE_OSX_ARCHITECTURES #define:
qt-cmake /Users/<user>/Qt/6.2.3/Src/qtbase/src/plugins/sqldrivers -DCMAKE_INSTALL_PREFIX=/Users/<user>/Qt/6.2.3/macos -DMySQL_INCLUDE_DIR="/usr/local/mysql/include" -DMySQL_LIBRARY="/usr/local/mysql/lib/libmysqlclient.dylib" -DCMAKE_OSX_ARCHITECTURES="arm64"
-
Hello, thank you again for your reply. I tried this command :
/Users/melvin_vga/Qt/6.2.3/macos/bin/qt-cmake /Users/melvin_vga/Qt/6.2.3/Src/qtbase/src/plugins/sqldrivers -DCMAKE_INSTALL_PREFIX=/Users/melvin_vga/Qt/6.2.3/macos -DMySQL_INCLUDE_DIR="/usr/local/mysql/include" -DMySQL_LIBRARY="/usr/local/mysql/lib/libmysqlclient.dylib" -DCMAKE_OSX_ARCHITECTURES="arm64"
I don't think there was a problem, but I prefer to show it :
-- The CXX compiler identification is AppleClang 13.0.0.13000029 -- The C compiler identification is AppleClang 13.0.0.13000029 -- The ASM compiler identification is Clang with GNU-like command-line -- Found assembler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Check for working CXX compiler: /usr/bin/clang++ - skipped -- Detecting CXX compile features -- Detecting CXX compile features - done -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Check for working C compiler: /usr/bin/clang - skipped -- Detecting C compile features -- Detecting C compile features - done -- Looking for pthread.h -- Looking for pthread.h - found -- Performing Test CMAKE_HAVE_LIBC_PTHREAD -- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success -- Found Threads: TRUE -- Performing Test HAVE_STDATOMIC -- Performing Test HAVE_STDATOMIC - Success -- Found WrapAtomic: TRUE -- Check for feature set changes -- Looking for a OBJC compiler -- Looking for a OBJC compiler - /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -- The OBJC compiler identification is AppleClang 13.0.0.13000029 -- Detecting OBJC compiler ABI info -- Detecting OBJC compiler ABI info - done -- Check for working OBJC compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang - skipped -- Looking for a OBJCXX compiler -- Looking for a OBJCXX compiler - /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -- The OBJCXX compiler identification is AppleClang 13.0.0.13000029 -- Detecting OBJCXX compiler ABI info -- Detecting OBJCXX compiler ABI info - done -- Check for working OBJCXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ - skipped -- Could NOT find DB2 (missing: DB2_INCLUDE_DIR DB2_LIBRARY) -- Found MySQL: /usr/local/mysql/lib/libmysqlclient.dylib -- Could NOT find PostgreSQL (missing: PostgreSQL_LIBRARY PostgreSQL_INCLUDE_DIR) -- Could NOT find Oracle (missing: Oracle_LIBRARY Oracle_INCLUDE_DIR) -- Could NOT find ODBC (missing: ODBC_INCLUDE_DIR) -- Found SQLite3: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.1.sdk/usr/include (found version "3.36.0") -- Could NOT find Interbase (missing: Interbase_LIBRARY Interbase_INCLUDE_DIR) -- Performing Test HAVE_DASH_UNDEFINED_SYMBOLS -- Performing Test HAVE_DASH_UNDEFINED_SYMBOLS - Success -- Performing Test HAVE_DASH_DASH_NO_UNDEFINED -- Performing Test HAVE_DASH_DASH_NO_UNDEFINED - Failed -- The following packages have been found: * Qt6BuildInternals (required version >= 6.2.3) * Qt6CoreTools (required version >= 6.2.3) * Qt6Core (required version >= 6.2.3) * Qt6Sql (required version >= 6.2.3) * Qt6 (required version >= 6.2.3) * MySQL, MySQL client library, <https://www.mysql.com> * SQLite3 -- The following OPTIONAL packages have not been found: * DB2, IBM DB2 client library, <https://www.ibm.com> * PkgConfig * PostgreSQL * Oracle, Oracle client library, <https://www.oracle.com> * ODBC * Interbase, Interbase client library, <https://www.embarcadero.com/products/interbase> Configure summary: Qt Sql Drivers: DB2 (IBM) .............................. no InterBase .............................. no MySql .................................. yes OCI (Oracle) ........................... no ODBC ................................... no PostgreSQL ............................. no SQLite ................................. yes Using system provided SQLite ......... no -- Configuring done -- Generating done -- Build files have been written to: /Users/melvin_vga/build-sqldrivers
Then I build with :
cmake --build .
And the build didn't work :
[ 9%] Automatic MOC for target QMYSQLDriverPlugin [ 9%] Built target QMYSQLDriverPlugin_autogen [ 18%] Building CXX object mysql/CMakeFiles/QMYSQLDriverPlugin.dir/QMYSQLDriverPlugin_autogen/mocs_compilation.cpp.o [ 27%] Building CXX object mysql/CMakeFiles/QMYSQLDriverPlugin.dir/main.cpp.o [ 36%] Building CXX object mysql/CMakeFiles/QMYSQLDriverPlugin.dir/qsql_mysql.cpp.o [ 45%] Linking CXX shared module ../plugins/sqldrivers/libqsqlmysql.dylib ld: warning: ignoring file /usr/local/mysql/lib/libmysqlclient.dylib, building for macOS-x86_64 but attempting to link with file built for macOS-arm64 Undefined symbols for architecture x86_64: "_mysql_affected_rows", referenced from: QMYSQLResult::reset(QString const&) in qsql_mysql.cpp.o QMYSQLResult::nextResult() in qsql_mysql.cpp.o "_mysql_character_set_name", referenced from: QMYSQLDriver::open(QString const&, QString const&, QString const&, QString const&, int, QString const&) (.cold.1) in qsql_mysql.cpp.o "_mysql_close", referenced from: QMYSQLDriver::open(QString const&, QString const&, QString const&, QString const&, int, QString const&) in qsql_mysql.cpp.o QMYSQLDriver::close() in qsql_mysql.cpp.o "_mysql_data_seek", referenced from: QMYSQLResult::fetch(int) in qsql_mysql.cpp.o "_mysql_errno", referenced from: qMakeError(QString const&, QSqlError::ErrorType, QMYSQLDriverPrivate const*) in qsql_mysql.cpp.o QMYSQLResult::record() const in qsql_mysql.cpp.o "_mysql_error", referenced from: qMakeError(QString const&, QSqlError::ErrorType, QMYSQLDriverPrivate const*) in qsql_mysql.cpp.o QMYSQLDriver::open(QString const&, QString const&, QString const&, QString const&, int, QString const&) (.cold.1) in qsql_mysql.cpp.o "_mysql_fetch_field", referenced from: QMYSQLResultPrivate::bindInValues() in qsql_mysql.cpp.o QMYSQLResult::record() const in qsql_mysql.cpp.o QMYSQLDriver::record(QString const&) const in qsql_mysql.cpp.o "_mysql_fetch_field_direct", referenced from: QMYSQLResult::reset(QString const&) in qsql_mysql.cpp.o QMYSQLResult::nextResult() in qsql_mysql.cpp.o "_mysql_fetch_lengths", referenced from: QMYSQLResult::data(int) in qsql_mysql.cpp.o "_mysql_fetch_row", referenced from: QMYSQLResult::fetch(int) in qsql_mysql.cpp.o QMYSQLResult::fetchNext() in qsql_mysql.cpp.o "_mysql_field_count", referenced from: QMYSQLResult::reset(QString const&) in qsql_mysql.cpp.o QMYSQLResult::nextResult() in qsql_mysql.cpp.o "_mysql_field_seek", referenced from: QMYSQLResult::record() const in qsql_mysql.cpp.o "_mysql_free_result", referenced from: QMYSQLResult::cleanup() in qsql_mysql.cpp.o QMYSQLResult::nextResult() in qsql_mysql.cpp.o QMYSQLDriver::record(QString const&) const in qsql_mysql.cpp.o "_mysql_init", referenced from: QMYSQLDriver::open(QString const&, QString const&, QString const&, QString const&, int, QString const&) in qsql_mysql.cpp.o "_mysql_insert_id", referenced from: QMYSQLResult::lastInsertId() const in qsql_mysql.cpp.o "_mysql_list_fields", referenced from: QMYSQLDriver::record(QString const&) const in qsql_mysql.cpp.o "_mysql_next_result", referenced from: QMYSQLResult::cleanup() in qsql_mysql.cpp.o QMYSQLResult::nextResult() in qsql_mysql.cpp.o "_mysql_num_fields", referenced from: QMYSQLResultPrivate::bindInValues() in qsql_mysql.cpp.o "_mysql_num_rows", referenced from: QMYSQLResult::fetchLast() in qsql_mysql.cpp.o QMYSQLResult::size() in qsql_mysql.cpp.o "_mysql_options", referenced from: QMYSQLDriver::open(QString const&, QString const&, QString const&, QString const&, int, QString const&) in qsql_mysql.cpp.o "_mysql_query", referenced from: QMYSQLDriver::beginTransaction() in qsql_mysql.cpp.o QMYSQLDriver::commitTransaction() in qsql_mysql.cpp.o QMYSQLDriver::rollbackTransaction() in qsql_mysql.cpp.o "_mysql_real_connect", referenced from: QMYSQLDriver::open(QString const&, QString const&, QString const&, QString const&, int, QString const&) in qsql_mysql.cpp.o "_mysql_real_escape_string", referenced from: QMYSQLDriver::formatValue(QSqlField const&, bool) const in qsql_mysql.cpp.o "_mysql_real_query", referenced from: QMYSQLResult::reset(QString const&) in qsql_mysql.cpp.o "_mysql_select_db", referenced from: QMYSQLDriver::open(QString const&, QString const&, QString const&, QString const&, int, QString const&) in qsql_mysql.cpp.o "_mysql_server_end", referenced from: QMYSQLDriver::~QMYSQLDriver() in qsql_mysql.cpp.o QMYSQLDriver::~QMYSQLDriver() in qsql_mysql.cpp.o QMYSQLDriver::~QMYSQLDriver() in qsql_mysql.cpp.o "_mysql_server_init", referenced from: QMYSQLDriver::QMYSQLDriver(QObject*) in qsql_mysql.cpp.o QMYSQLDriver::QMYSQLDriver(MYSQL*, QObject*) in qsql_mysql.cpp.o "_mysql_set_character_set", referenced from: QMYSQLDriver::open(QString const&, QString const&, QString const&, QString const&, int, QString const&) in qsql_mysql.cpp.o "_mysql_ssl_set", referenced from: QMYSQLDriver::open(QString const&, QString const&, QString const&, QString const&, int, QString const&) in qsql_mysql.cpp.o "_mysql_stmt_affected_rows", referenced from: QMYSQLResult::exec() in qsql_mysql.cpp.o "_mysql_stmt_attr_set", referenced from: QMYSQLResult::exec() in qsql_mysql.cpp.o "_mysql_stmt_bind_param", referenced from: QMYSQLResult::exec() in qsql_mysql.cpp.o "_mysql_stmt_bind_result", referenced from: QMYSQLResult::exec() in qsql_mysql.cpp.o "_mysql_stmt_close", referenced from: QMYSQLResult::cleanup() in qsql_mysql.cpp.o QMYSQLDriver::open(QString const&, QString const&, QString const&, QString const&, int, QString const&) in qsql_mysql.cpp.o "_mysql_stmt_data_seek", referenced from: QMYSQLResult::fetch(int) in qsql_mysql.cpp.o "_mysql_stmt_errno", referenced from: qMakeStmtError(QString const&, QSqlError::ErrorType, MYSQL_STMT*) in qsql_mysql.cpp.o "_mysql_stmt_error", referenced from: qMakeStmtError(QString const&, QSqlError::ErrorType, MYSQL_STMT*) in qsql_mysql.cpp.o "_mysql_stmt_execute", referenced from: QMYSQLResult::exec() in qsql_mysql.cpp.o "_mysql_stmt_fetch", referenced from: QMYSQLResult::fetch(int) in qsql_mysql.cpp.o QMYSQLResult::fetchNext() in qsql_mysql.cpp.o "_mysql_stmt_free_result", referenced from: QMYSQLResult::detachFromResultSet() in qsql_mysql.cpp.o "_mysql_stmt_init", referenced from: QMYSQLResult::prepare(QString const&) in qsql_mysql.cpp.o QMYSQLDriver::open(QString const&, QString const&, QString const&, QString const&, int, QString const&) in qsql_mysql.cpp.o "_mysql_stmt_insert_id", referenced from: QMYSQLResult::lastInsertId() const in qsql_mysql.cpp.o "_mysql_stmt_num_rows", referenced from: QMYSQLResult::fetchLast() in qsql_mysql.cpp.o QMYSQLResult::size() in qsql_mysql.cpp.o "_mysql_stmt_param_count", referenced from: QMYSQLResult::prepare(QString const&) in qsql_mysql.cpp.o QMYSQLResult::exec() in qsql_mysql.cpp.o QMYSQLDriver::open(QString const&, QString const&, QString const&, QString const&, int, QString const&) in qsql_mysql.cpp.o "_mysql_stmt_prepare", referenced from: QMYSQLResult::prepare(QString const&) in qsql_mysql.cpp.o QMYSQLDriver::open(QString const&, QString const&, QString const&, QString const&, int, QString const&) in qsql_mysql.cpp.o "_mysql_stmt_reset", referenced from: QMYSQLResult::exec() in qsql_mysql.cpp.o "_mysql_stmt_result_metadata", referenced from: QMYSQLResultPrivate::bindInValues() in qsql_mysql.cpp.o "_mysql_stmt_store_result", referenced from: QMYSQLResult::exec() in qsql_mysql.cpp.o "_mysql_store_result", referenced from: QMYSQLResult::cleanup() in qsql_mysql.cpp.o QMYSQLResult::reset(QString const&) in qsql_mysql.cpp.o QMYSQLResult::nextResult() in qsql_mysql.cpp.o "_mysql_thread_end", referenced from: QMYSQLDriver::close() in qsql_mysql.cpp.o "_mysql_thread_init", referenced from: QMYSQLDriver::open(QString const&, QString const&, QString const&, QString const&, int, QString const&) in qsql_mysql.cpp.o ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation) make[2]: *** [plugins/sqldrivers/libqsqlmysql.dylib] Error 1 make[1]: *** [mysql/CMakeFiles/QMYSQLDriverPlugin.dir/all] Error 2 make: *** [all] Error 2
-
I uninstalled version 6.2.3 using the maintenance tool and I reinstalled it but it gives me the same errors after redoing the qtcmake and the build
-
I think I've found the answer, first, while
-DCMAKE_OSX_ARCHITECTURES=arm64
works fine for building the sqllite and odbc plugins, it does not work for mysql :-(Instead, you'll have to edit the link.txt command file manually.
So new instructions are:- Do the vanilla qt-cmake build command:
/Users/melvin_vga/Qt/6.2.3/macos/bin/qt-cmake /Users/melvin_vga/Qt/6.2.3/Src/qtbase/src/plugins/sqldrivers -DCMAKE_INSTALL_PREFIX=/Users/melvin_vga/Qt/6.2.3/macos -DMySQL_INCLUDE_DIR="/usr/local/mysql/include" -DMySQL_LIBRARY="/usr/local/mysql/lib/libmysqlclient.dylib"
- Go into the directory
/Users/melvin_vga/Qt/6.2.3/Src/qtbase/src/plugins/sqldrivers/mysql/CMakeFiles/QMYSQLDriverPlugin.dir
and look for a file called link.txt
it should consist of one line beginning with:
/usr/bin/clang++ -g -DNDEBUG -O2 -arch x86_64 -isysroot /Applications/Xcode.app/Conten...
change x86_64 to arm64 like so:
/usr/bin/clang++ -g -DNDEBUG -O2 -arch arm64 -isysroot /Applications/Xcode.app/Conten...
then try the
cmake --build .
again - Do the vanilla qt-cmake build command:
-
I don't have a file name CMakeFiles in :
/Users/melvin_vga/Qt/6.2.3/Src/qtbase/src/plugins/sqldrivers/mysql
-
CMakeFiles is not a file, it's a subdirectory
Note I edited my post above, I think it suffices that you edit the link.txt file -
As you can see from the screenshot I posted above, I don't have the subdirectory named CMakeFiles in "mysql" and therefore not the link.txt in qt but it is in the build-sqldrivers after typing the command.
I still tried to make the changes in the link.txt of build-sqldrivers with arm and this gives this build which seems normal to me since I did not make any changes in the QT folder :
-
Nice, now cmake does not complain about linking with Homebrew's MySQL client (link.txt is ok with "... -arch arm64...")
One final step: fixing the 3 .o files so that they are built for arm64 (and not x86_64):
Go to the same directory as when you edited the link.txt file:
/Users/melvin_vga/Qt/6.2.3/Src/qtbase/src/plugins/sqldrivers/mysql/CMakeFiles/QMYSQLDriverPlugin.dir
and look for a file called flags.make
It should have 11 lines (the first one says "DO NOT EDIT" we will do it anyway :-)
The last line in the file should begin with:CXX_FLAGS = -g -DNDEBUG -O2 -arch x86_64 -isysroot /Applications/Xcode.app/Conten...
change x86_64 to arm64:
CXX_FLAGS = -g -DNDEBUG -O2 -arch arm64 -isysroot /Applications/Xcode.app/Conten...
then try the
cmake --build .
again -
Is this message good ?
-
Yes looks good, you have the plugin built for arm64.
Now you need to copy it into your Qt 6.2.3 installation.
You have done that bedore, see the post above for using the find command in Terminal to see where the .dylib is, snd then copy it into yout Qt. -
I need to install no ?
cmake --install .