Problème d'installation du driver QMySql
-
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 .
-
I don't have cmake install I just moved the build file into the qt file and it works perfectly! thank you very much!