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. building Qt MYSQL driver for MAC OS
QtWS25 Last Chance

building Qt MYSQL driver for MAC OS

Scheduled Pinned Locked Moved Solved General and Desktop
9 Posts 5 Posters 661 Views
  • 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.
  • D Offline
    D Offline
    DeadSo0ul
    wrote on last edited by DeadSo0ul
    #1

    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 driver

    qt-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"
    
    Christian EhrlicherC 1 Reply Last reply
    0
    • D DeadSo0ul

      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 driver

      qt-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"
      
      Christian EhrlicherC Offline
      Christian EhrlicherC Offline
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on last edited by Christian Ehrlicher
      #2

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

      Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
      Visit the Qt Academy at https://academy.qt.io/catalog

      1 Reply Last reply
      2
      • D Offline
        D Offline
        DeadSo0ul
        wrote on last edited by
        #3

        @Christian-Ehrlicher
        You are correct, thanks!
        I did manage to compile the driver with ninja and everything linked.

        1 Reply Last reply
        0
        • SGaistS SGaist has marked this topic as solved on
        • A Offline
          A Offline
          allenck
          wrote on last edited by
          #4

          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_temp

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

          Allen Kempe

          1 Reply Last reply
          0
          • hskoglundH Offline
            hskoglundH Offline
            hskoglund
            wrote on last edited by
            #5

            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.

            A 2 Replies Last reply
            0
            • hskoglundH hskoglund

              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.

              A Offline
              A Offline
              allenck
              wrote on last edited by
              #6

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

              Allen Kempe

              1 Reply Last reply
              0
              • hskoglundH hskoglund

                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.

                A Offline
                A Offline
                allenck
                wrote on last edited by allenck
                #7

                @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
                

                Allen Kempe

                SGaistS 1 Reply Last reply
                0
                • A allenck

                  @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
                  
                  SGaistS Offline
                  SGaistS Offline
                  SGaist
                  Lifetime Qt Champion
                  wrote on last edited by
                  #8

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

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

                  A 1 Reply Last reply
                  0
                  • SGaistS SGaist

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

                    A Offline
                    A Offline
                    allenck
                    wrote on last edited by
                    #9

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

                    Allen Kempe

                    1 Reply Last reply
                    0

                    • Login

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