MySQL driver detected but not loading on MacOS
-
@Vince2480 Both seems to be 64bit libs, except that libmysqlclient.20.dylib is missing x86_64.
Do you by any chance use a M1 Mac? -
Hi,
Two solutions I can see here:
- Build Qt yourself for the M1
- Have a parallel install of brew which installs the x86_64 variants of the packages you need.
-
@Vince2480 To add to @SGaist : QtCompany does not yet provide Apple Silicon Qt builds. That means you have x86_64 Qt build but MySQL client lib is ARM. This can't work, so you have to make sure both are same architecture (either ARM or x86_64), see @SGaist suggestion.
-
@Vince2480 To add to @SGaist : QtCompany does not yet provide Apple Silicon Qt builds. That means you have x86_64 Qt build but MySQL client lib is ARM. This can't work, so you have to make sure both are same architecture (either ARM or x86_64), see @SGaist suggestion.
-
@Vince2480 said in MySQL driver detected but not loading on MacOS:
I assume I don't need to build Qt Creator?
No.
Just add a new Kit with your self-built Qt. -
@Vince2480 said in MySQL driver detected but not loading on MacOS:
@jsulm I'll build Qt from sources as @SGaist has suggested, from the Qt5 git repository. I assume I don't need to build Qt Creator?
Do not forget to checkout the exact version you want. The default branch when cloning is dev so Qt 6.
-
@Vince2480 said in MySQL driver detected but not loading on MacOS:
@jsulm I'll build Qt from sources as @SGaist has suggested, from the Qt5 git repository. I assume I don't need to build Qt Creator?
Do not forget to checkout the exact version you want. The default branch when cloning is dev so Qt 6.
-
That's wrong. The same rules apply for the MySQL plugin in Qt 6 than in Qt 5.
Qt has a lot more database plugins that what is provided in the pre-built binaries. Some of them require commercial dependencies that needs to be acquired by the developer/companies that wants to use them so they won't be part of the pre-built binaries either.
-
That's wrong. The same rules apply for the MySQL plugin in Qt 6 than in Qt 5.
Qt has a lot more database plugins that what is provided in the pre-built binaries. Some of them require commercial dependencies that needs to be acquired by the developer/companies that wants to use them so they won't be part of the pre-built binaries either.
@SGaist I could not build Qt from sources, too many errors for me to understand, I'm only a hobby programmer. I read Qt company says 6.2 beta is M1 compliant. therefore I installed with Maintenance tool.
MySql plugins were present in Qt5.9.9 but definitely not in 6.
Now I'm trying to find the libmysql source files, all I can find are binaries Connector/C++ at dev.MySql.com
-
@Vince2480 said in MySQL driver detected but not loading on MacOS:
MySql plugins were present in Qt5.9.9 but definitely not in 6.
And not in 5.14 and 5.15. Oracle has changed its licensing scheme and thus the Qt Company does not provide the pre-built plugin anymore. You can build it yourself for your Qt version if you get the x86_64 version of the connectior.
-
Ok, I need help building MySql.
Just to be sure what I'm doing is right,
Attempting to build the x86-64 version drivers
I Downloaded the MySql source package withgit clone https://github.com/mysql/mysql-connector-cpp.git git checkout 8.0
Next I ran cmake
cmake cmakelists.txt
-- The C compiler identification is AppleClang 12.0.5.12050022 -- The CXX compiler identification is AppleClang 12.0.5.12050022 -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc - skipped -- Detecting C compile features -- Detecting C compile features - done -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ - skipped -- Detecting CXX compile features -- Detecting CXX compile features - done -- BIG_ENDIAN: 0 Building version 8.0.26 Building on system: Darwin-20.6.0 (arm64) Using cmake generator: Unix Makefiles Using toolset: Building 64bit code Building shared connector library Configuring CDK as part of MySQL_CONCPP project -- Looking for SSL library. CMake Error at cdk/cmake/DepFindSSL.cmake:79 (message): Cannot find appropriate system libraries for SSL. Make sure you've specified a supported SSL version. Consult the documentation for WITH_SSL alternatives Call Stack (most recent call first): cdk/cmake/DepFindSSL.cmake:354 (main) cdk/cmake/dependency.cmake:42 (include) cdk/CMakeLists.txt:96 (find_dependency)
% which openssl /opt/homebrew/cellar/openssl@1.1/1.1.1k/bin/openssl
Is it possible OpenSSL isn't M1 compliant?
-
You need to build that targeting x86_64 not ARM.
-
@Vince2480 said in MySQL driver detected but not loading on MacOS:
Are you saying MySql plugin can't be built for M1?
No, that's not what @SGaist is saying.
The thing is that you have x86_64 Qt, right? If so, then you also need x86_64 build of the MySql plug-in. -
@Vince2480 said in MySQL driver detected but not loading on MacOS:
Are you saying MySql plugin can't be built for M1?
No, that's not what @SGaist is saying.
The thing is that you have x86_64 Qt, right? If so, then you also need x86_64 build of the MySql plug-in. -
I am also faced with the similar problems and I have got no clear answers from Qt person. In my case, my configuration is
macOS Monterey with Intel cpu,
PostgreSQL is running on docker with the official image Postgres:latest, i.e., PostgreSQL 14.5, which was updated yesterday in my Mac.The day before yesterday, my code has worked fine. There was no problem. Yesterday, I changed the PostgreSQL docker image to be the newer version, "postgres:latest". No source code of my app has been changed. So, I have tried to remove the Qt installs it again several times.
My final choice is to downgrade the PostgreSQL docker image to the "Postgres:14" for which I wish to work fine. If this treatment works, the QPSQL driver code or driver selection procedure has serious problem conceptually. A complete redesign may be necessary.
Let me give you the result tomorrow.
-
I am also faced with the similar problems and I have got no clear answers from Qt person. In my case, my configuration is
macOS Monterey with Intel cpu,
PostgreSQL is running on docker with the official image Postgres:latest, i.e., PostgreSQL 14.5, which was updated yesterday in my Mac.The day before yesterday, my code has worked fine. There was no problem. Yesterday, I changed the PostgreSQL docker image to be the newer version, "postgres:latest". No source code of my app has been changed. So, I have tried to remove the Qt installs it again several times.
My final choice is to downgrade the PostgreSQL docker image to the "Postgres:14" for which I wish to work fine. If this treatment works, the QPSQL driver code or driver selection procedure has serious problem conceptually. A complete redesign may be necessary.
Let me give you the result tomorrow.
@In-Gee said in MySQL driver detected but not loading on MacOS:
I am also faced with the similar problems
Driver not loaded?
Changing the PostgreSQL server should not have any influence on whether the Qt driver plug-in can be loaded or not. Are you sure you have same problem as in this thread? Did you verify that the PostgreSQL plug-in can't be loaded? -
@In-Gee said in MySQL driver detected but not loading on MacOS:
I am also faced with the similar problems
Driver not loaded?
Changing the PostgreSQL server should not have any influence on whether the Qt driver plug-in can be loaded or not. Are you sure you have same problem as in this thread? Did you verify that the PostgreSQL plug-in can't be loaded?@jsulm I just fixed the problem. Let me just explain how I found the problem step by step. (macOS)
- I prefer the Docker base PostgreSQL and install the Homebrew version of PostgreSQL. This is convenient to me because every upgrade apps can be done by a single command, $ brew upgrade.
- I activated QT_DEBUG_PLUGINS = 1 in the Qt Creator Environment setting. I have struggled to figure out how to do it, because I am a beginner for the Qt development situation. I have not understand what your are talking about.
- I followed the detailed debug message and found out the problem is the Qt is looking for the relevant QPSQL library based on the assumption such that the user has installed the PostgreSQL by using the PostgreSQL App.
- Problem is here: The Qt engineers could give a priority to the PostgreSQL.App installation but they has to consider the directory search for the users with Homebrew or the other installation methods as well.
- So I installed the PostgreSQL.App by downloading from the PostgreSQL website, stop the existing docker, runt the PostgreSQL.App and stop it followed by run the docker again. Then I compiled my source code again and I got it.
- It is recommended to consider the configuration the QPSQL driver, and also the other drivers, other mfethod/directory installations. The Unix command, "which", may give the hint to figure out the user preference. I hope the Qt engineers may consider the various situations with little bit clever way.
Thanks for your interests.
-
@jsulm I just fixed the problem. Let me just explain how I found the problem step by step. (macOS)
- I prefer the Docker base PostgreSQL and install the Homebrew version of PostgreSQL. This is convenient to me because every upgrade apps can be done by a single command, $ brew upgrade.
- I activated QT_DEBUG_PLUGINS = 1 in the Qt Creator Environment setting. I have struggled to figure out how to do it, because I am a beginner for the Qt development situation. I have not understand what your are talking about.
- I followed the detailed debug message and found out the problem is the Qt is looking for the relevant QPSQL library based on the assumption such that the user has installed the PostgreSQL by using the PostgreSQL App.
- Problem is here: The Qt engineers could give a priority to the PostgreSQL.App installation but they has to consider the directory search for the users with Homebrew or the other installation methods as well.
- So I installed the PostgreSQL.App by downloading from the PostgreSQL website, stop the existing docker, runt the PostgreSQL.App and stop it followed by run the docker again. Then I compiled my source code again and I got it.
- It is recommended to consider the configuration the QPSQL driver, and also the other drivers, other mfethod/directory installations. The Unix command, "which", may give the hint to figure out the user preference. I hope the Qt engineers may consider the various situations with little bit clever way.
Thanks for your interests.
@In-Gee said in MySQL driver detected but not loading on MacOS:
I hope the Qt engineers may consider the various situations with little bit clever way
You could file a change request in Qt Bug Tracker: https://bugreports.qt.io/secure/Dashboard.jspa