Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. MySQL driver detected but not loading on MacOS
Forum Updated to NodeBB v4.3 + New Features

MySQL driver detected but not loading on MacOS

Scheduled Pinned Locked Moved Unsolved General and Desktop
62 Posts 8 Posters 13.0k Views 3 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • V Vince2480

    @jsulm libmysqlclient.20.dylib is not on my system so does that means I need to install MySQL? I didn't do that for Qt5.4, has something changed between then and now?

    jsulmJ Offline
    jsulmJ Offline
    jsulm
    Lifetime Qt Champion
    wrote on last edited by jsulm
    #14

    @Vince2480 said in MySQL driver detected but not loading on MacOS:

    install MySQL?

    Not the server, only client.

    "has something changed between then and now?" - yes, the MySQL license has changed (since Oracle owns MySQL). Because of that QtCompany does not include MySQL client lib anymore in the Qt builds it's providing.

    https://forum.qt.io/topic/113070/qt-code-of-conduct

    V 1 Reply Last reply
    0
    • jsulmJ jsulm

      @Vince2480 said in MySQL driver detected but not loading on MacOS:

      install MySQL?

      Not the server, only client.

      "has something changed between then and now?" - yes, the MySQL license has changed (since Oracle owns MySQL). Because of that QtCompany does not include MySQL client lib anymore in the Qt builds it's providing.

      V Offline
      V Offline
      Vince2480
      wrote on last edited by Vince2480
      #15

      @jsulm OK, I see.

      I installed

      brew install mysql-client
      

      only libmysqlclient.21.dylib so I linked with libmysqlclient.20.dylib
      but it's the wrong architecture.

      Cannot load library /Users/vinceieraci/Qt/5.9.9/clang_64/plugins/sqldrivers/libqsqlmysql.dylib: (dlopen(/Users/vinceieraci/Qt/5.9.9/clang_64/plugins/sqldrivers/libqsqlmysql.dylib, 133): Library not loaded: /usr/local/mysql/lib/libmysqlclient.20.dylib
        Referenced from: /Users/vinceieraci/Qt/5.9.9/clang_64/plugins/sqldrivers/libqsqlmysql.dylib
        Reason: no suitable image found.  Did find:
      	/opt/homebrew/Cellar/mysql-client/8.0.26/lib/libmysqlclient.20.dylib: mach-o, but wrong architecture
      	/opt/homebrew/Cellar/mysql-client/8.0.26/lib/libmysqlclient.20.dylib: mach-o, but wrong architecture)
      

      I downloaded mysql-connector-c++ but that doesn't look viable.
      Where do I find the required files?

      jsulmJ 1 Reply Last reply
      0
      • V Vince2480

        @jsulm OK, I see.

        I installed

        brew install mysql-client
        

        only libmysqlclient.21.dylib so I linked with libmysqlclient.20.dylib
        but it's the wrong architecture.

        Cannot load library /Users/vinceieraci/Qt/5.9.9/clang_64/plugins/sqldrivers/libqsqlmysql.dylib: (dlopen(/Users/vinceieraci/Qt/5.9.9/clang_64/plugins/sqldrivers/libqsqlmysql.dylib, 133): Library not loaded: /usr/local/mysql/lib/libmysqlclient.20.dylib
          Referenced from: /Users/vinceieraci/Qt/5.9.9/clang_64/plugins/sqldrivers/libqsqlmysql.dylib
          Reason: no suitable image found.  Did find:
        	/opt/homebrew/Cellar/mysql-client/8.0.26/lib/libmysqlclient.20.dylib: mach-o, but wrong architecture
        	/opt/homebrew/Cellar/mysql-client/8.0.26/lib/libmysqlclient.20.dylib: mach-o, but wrong architecture)
        

        I downloaded mysql-connector-c++ but that doesn't look viable.
        Where do I find the required files?

        jsulmJ Offline
        jsulmJ Offline
        jsulm
        Lifetime Qt Champion
        wrote on last edited by
        #16

        @Vince2480 What does

        file /opt/homebrew/Cellar/mysql-client/8.0.26/lib/libmysqlclient.20.dylib
        

        and

        file /Users/vinceieraci/Qt/5.9.9/clang_64/plugins/sqldrivers/libqsqlmysql.dylib
        

        output?

        https://forum.qt.io/topic/113070/qt-code-of-conduct

        V 1 Reply Last reply
        0
        • jsulmJ jsulm

          @Vince2480 What does

          file /opt/homebrew/Cellar/mysql-client/8.0.26/lib/libmysqlclient.20.dylib
          

          and

          file /Users/vinceieraci/Qt/5.9.9/clang_64/plugins/sqldrivers/libqsqlmysql.dylib
          

          output?

          V Offline
          V Offline
          Vince2480
          wrote on last edited by
          #17

          @jsulm Excuse my ignorance, I don't understand the question.

          JonBJ 1 Reply Last reply
          0
          • V Vince2480

            @jsulm Excuse my ignorance, I don't understand the question.

            JonBJ Online
            JonBJ Online
            JonB
            wrote on last edited by
            #18

            @Vince2480
            From a command prompt/terminal/shell, copy & paste exactly each of the two lines @jsulm typed, and paste back here what response you get.

            V 1 Reply Last reply
            0
            • JonBJ JonB

              @Vince2480
              From a command prompt/terminal/shell, copy & paste exactly each of the two lines @jsulm typed, and paste back here what response you get.

              V Offline
              V Offline
              Vince2480
              wrote on last edited by
              #19

              @JonB

              /opt/homebrew/Cellar/mysql-client/8.0.26/lib/libmysqlclient.20.dylib: Mach-O 64-bit dynamically linked shared library
              
              /Users/vinceieraci/Qt/5.9.9/clang_64/plugins/sqldrivers/libqsqlmysql.dylib: Mach-O 64-bit dynamically linked shared library x86_64
              
              jsulmJ 1 Reply Last reply
              0
              • V Vince2480

                @JonB

                /opt/homebrew/Cellar/mysql-client/8.0.26/lib/libmysqlclient.20.dylib: Mach-O 64-bit dynamically linked shared library
                
                /Users/vinceieraci/Qt/5.9.9/clang_64/plugins/sqldrivers/libqsqlmysql.dylib: Mach-O 64-bit dynamically linked shared library x86_64
                
                jsulmJ Offline
                jsulmJ Offline
                jsulm
                Lifetime Qt Champion
                wrote on last edited by
                #20

                @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?

                https://forum.qt.io/topic/113070/qt-code-of-conduct

                V 1 Reply Last reply
                0
                • jsulmJ jsulm

                  @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?

                  V Offline
                  V Offline
                  Vince2480
                  wrote on last edited by
                  #21

                  @jsulm Yes. M1 MacBook Pro.

                  jsulmJ 1 Reply Last reply
                  0
                  • SGaistS Offline
                    SGaistS Offline
                    SGaist
                    Lifetime Qt Champion
                    wrote on last edited by
                    #22

                    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.

                    Interested in AI ? www.idiap.ch
                    Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                    1 Reply Last reply
                    1
                    • V Vince2480

                      @jsulm Yes. M1 MacBook Pro.

                      jsulmJ Offline
                      jsulmJ Offline
                      jsulm
                      Lifetime Qt Champion
                      wrote on last edited by
                      #23

                      @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.

                      https://forum.qt.io/topic/113070/qt-code-of-conduct

                      V 1 Reply Last reply
                      1
                      • jsulmJ jsulm

                        @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.

                        V Offline
                        V Offline
                        Vince2480
                        wrote on last edited by
                        #24

                        @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?

                        jsulmJ SGaistS 2 Replies Last reply
                        0
                        • V Vince2480

                          @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?

                          jsulmJ Offline
                          jsulmJ Offline
                          jsulm
                          Lifetime Qt Champion
                          wrote on last edited by
                          #25

                          @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.

                          https://forum.qt.io/topic/113070/qt-code-of-conduct

                          1 Reply Last reply
                          0
                          • V Vince2480

                            @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?

                            SGaistS Offline
                            SGaistS Offline
                            SGaist
                            Lifetime Qt Champion
                            wrote on last edited by
                            #26

                            @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.

                            Interested in AI ? www.idiap.ch
                            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                            V 1 Reply Last reply
                            0
                            • SGaistS SGaist

                              @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.

                              V Offline
                              V Offline
                              Vince2480
                              wrote on last edited by Vince2480
                              #27

                              @SGaist Ran into many problems trying to build the sources, fo

                              I don't think Qt6 has any MySQL plugins because they weren't in the pre-built version.

                              1 Reply Last reply
                              0
                              • SGaistS Offline
                                SGaistS Offline
                                SGaist
                                Lifetime Qt Champion
                                wrote on last edited by
                                #28

                                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.

                                Interested in AI ? www.idiap.ch
                                Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                                V 1 Reply Last reply
                                1
                                • SGaistS SGaist

                                  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.

                                  V Offline
                                  V Offline
                                  Vince2480
                                  wrote on last edited by
                                  #29

                                  @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

                                  1 Reply Last reply
                                  0
                                  • SGaistS Offline
                                    SGaistS Offline
                                    SGaist
                                    Lifetime Qt Champion
                                    wrote on last edited by
                                    #30

                                    @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.

                                    Interested in AI ? www.idiap.ch
                                    Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                                    1 Reply Last reply
                                    1
                                    • V Offline
                                      V Offline
                                      Vince2480
                                      wrote on last edited by Vince2480
                                      #31

                                      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 with

                                      git 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?

                                      1 Reply Last reply
                                      0
                                      • V Offline
                                        V Offline
                                        Vince2480
                                        wrote on last edited by
                                        #32

                                        I think I'm barking up the wrong tree...

                                        1 Reply Last reply
                                        0
                                        • SGaistS Offline
                                          SGaistS Offline
                                          SGaist
                                          Lifetime Qt Champion
                                          wrote on last edited by
                                          #33

                                          You need to build that targeting x86_64 not ARM.

                                          Interested in AI ? www.idiap.ch
                                          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                                          V 1 Reply Last reply
                                          1

                                          • Login

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular
                                          • Users
                                          • Groups
                                          • Search
                                          • Get Qt Extensions
                                          • Unsolved