Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Update: Forum Guidelines & Code of Conduct

    Unsolved Problems Building MySql plugin on Mac M1 Qt 6.1.2

    General and Desktop
    4
    19
    361
    Loading More Posts
    • 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 last edited by Vince2480

      I've been struggling with this for a week now, feeling pretty frustrated, but having finally found the right MySql package, I'm nearly there.

      Problem now is in the last steps of building the MySql plugin and I think the doc (https://doc-snapshots.qt.io/qt6-dev/sql-driver.html#qmysql) is wrong!

      The first step seems to have generated all the files without errors.

      qt-cmake -G"Ninja" <qt_installation_path>/Src/qtbase/src/plugins/sqldrivers -DCMAKE_INSTALL_PREFIX=<qt_installation_path>/<platform> -DMySQL_INCLUDE_DIR="/usr/local/mysql/include" -DMySQL_LIBRARY="/usr/local/mysql/lib/libmysqlclient.<so|dylib>"
      

      The second step isn't.

      qt-cmake --build .
      

      CMake Error: Unknown argument --build
      CMake Error: Run 'cmake --help' for all supported options.
      etc...etc..etc...

      Does the dot (.) indicates the current directory?
      If so, I changed the parameters, 
      

      qt-cmake --build ../build-sqldrivers

      And that seemed to work, as seen in the summary:
      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
      CMake Warning:
      Manually-specified variables were not used by the project:

      CMAKE_TOOLCHAIN_FILE
      

      -- Build files have been written to: /Users/vinceieraci/Qt/6.1.2/Src/qtbase/src/plugins/build-sqldrivers

      But I don't see any plugins.
      Was that warning important?
      Can anyone help me please?
      Christian Ehrlicher 1 Reply Last reply Reply Quote 0
      • Christian Ehrlicher
        Christian Ehrlicher Lifetime Qt Champion @Vince2480 last edited by

        @Vince2480 said in Problems Building MySql plugin on Mac M1 Qt 6.1.2:

        But I don't see any plugins.

        Because you did not build it anywhere. Call make or whatever your build command is as explained in the documentation.

        Qt has to stay free or it will die.

        V 1 Reply Last reply Reply Quote 0
        • V
          Vince2480 @Christian Ehrlicher last edited by

          @Christian-Ehrlicher Where is this line wrong?

          qt-cmake -G"Ninja" /users/vinceieraci/qt/6.1.2/Src/qtbase/src/plugins/sqldrivers -DCMAKE_INSTALL_PREFIX=/users/vinceieraci/qt/6.1.2/macos -DMySQL_INCLUDE_DIR="/usr/local/mysql/include" -DMySQL_LIBRARY="/usr/local/mysql/lib/libmysqlclient.dylib"

          Christian Ehrlicher 1 Reply Last reply Reply Quote 0
          • Christian Ehrlicher
            Christian Ehrlicher Lifetime Qt Champion @Vince2480 last edited by

            @Vince2480 Sorry, I've overseen --build

            Does this command executes gcc or clang (don't know what you're using). If so a .so file should be created in your build dir.

            Qt has to stay free or it will die.

            V 1 Reply Last reply Reply Quote 0
            • V
              Vince2480 @Christian Ehrlicher last edited by

              @Christian-Ehrlicher There is no .so file in that directory.
              It appears to be using AppleClang.
              Here is the full output.

              -- The CXX compiler identification is AppleClang 12.0.5.12050022
              -- The C compiler identification is AppleClang 12.0.5.12050022
              -- The ASM compiler identification is Clang
              -- 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 12.0.5.12050022
              -- 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 12.0.5.12050022
              -- 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/MacOSX11.3.sdk/usr/include (found version "3.32.3") 
              -- 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
               * Qt6CoreTools (required version >= 6.1.2)
               * Qt6Core
               * Qt6Sql
               * Qt6 (required version >= 6.1.0)
               * 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>
               * 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/vinceieraci/Qt/6.1.2/Src/qtbase/src/plugins/build-sqldrivers
              
              1 Reply Last reply Reply Quote 0
              • Christian Ehrlicher
                Christian Ehrlicher Lifetime Qt Champion last edited by

                Your output only covers the configure step, not the build step. As I said (and you already told me) you have to call cmake --build or make afterwards.

                Qt has to stay free or it will die.

                V 1 Reply Last reply Reply Quote 0
                • V
                  Vince2480 @Christian Ehrlicher last edited by

                  @Christian-Ehrlicher OK, I can see a file CMakeError.log and there is an issue with gcc. What does the mean? Do I have to download something else or is it already somewhere on my system?

                  Checking whether the ASM compiler is GNU using "--version" did not match "(GNU assembler)|(GCC)|(Free Software Foundation)":
                  Apple clang version 12.0.5 (clang-1205.0.22.11)
                  Target: arm64-apple-darwin20.6.0
                  Thread model: posix
                  InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
                  Compiling the OBJC compiler identification source file "CMakeOBJCCompilerId.m" failed.
                  Compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang 
                  Build flags: 
                  Id flags:  
                  
                  The output was:
                  1
                  ld: library not found for -lSystem
                  clang: error: linker command failed with exit code 1 (use -v to see invocation)
                  
                  
                  Compiling the OBJCXX compiler identification source file "CMakeOBJCXXCompilerId.mm" failed.
                  Compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ 
                  Build flags: 
                  Id flags:  
                  
                  The output was:
                  1
                  ld: library not found for -lc++
                  clang: error: linker command failed with exit code 1 (use -v to see invocation)
                  
                  
                  Performing C++ SOURCE FILE Test HAVE_DASH_DASH_NO_UNDEFINED failed with the following output:
                  Change Dir: /Users/vinceieraci/Qt/6.1.2/Src/qtbase/src/plugins/build-sqldrivers/CMakeFiles/CMakeTmp
                  
                  Run Build Command(s):/opt/local/bin/ninja cmTC_bead5 && [1/2] Building CXX object CMakeFiles/cmTC_bead5.dir/src.cxx.o
                  [2/2] Linking CXX executable cmTC_bead5
                  FAILED: cmTC_bead5 
                  : && /usr/bin/clang++ -arch arm64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.3.sdk -mmacosx-version-min=10.14 -Wl,-search_paths_first -Wl,-headerpad_max_install_names -Wl,--no-undefined CMakeFiles/cmTC_bead5.dir/src.cxx.o -o cmTC_bead5   && :
                  ld: unknown option: --no-undefined
                  clang: error: linker command failed with exit code 1 (use -v to see invocation)
                  ninja: build stopped: subcommand failed.
                  
                  
                  Source file was:
                  int main() {}
                  
                  1 Reply Last reply Reply Quote 0
                  • Christian Ehrlicher
                    Christian Ehrlicher Lifetime Qt Champion last edited by

                    I don't see what CMakeError.log has to do with it - the configuration stage is fine. Now you only have to compile it as already said two times - giving up...

                    Qt has to stay free or it will die.

                    V 1 Reply Last reply Reply Quote 0
                    • V
                      Vince2480 @Christian Ehrlicher last edited by

                      @Christian-Ehrlicher Thanks for helping.

                      1 Reply Last reply Reply Quote 0
                      • V
                        Vince2480 last edited by

                        So is it that the ASM compiler doesn't match the required gcc version?
                        I've installed gcc-11 using brew and it's first in the $PATH variable, but it's still defaulting ti the Xcode clang version.

                        1 Reply Last reply Reply Quote 0
                        • Christian Ehrlicher
                          Christian Ehrlicher Lifetime Qt Champion last edited by

                          Is it so hard to simply type make to actually build to sources??

                          Qt has to stay free or it will die.

                          V 1 Reply Last reply Reply Quote 0
                          • V
                            Vince2480 @Christian Ehrlicher last edited by

                            @Christian-Ehrlicher I've done that, this is what I get...

                            % make
                            

                            make: *** No targets specified and no makefile found. Stop.

                            1 Reply Last reply Reply Quote 0
                            • Christian Ehrlicher
                              Christian Ehrlicher Lifetime Qt Champion last edited by

                              @Vince2480 said in Problems Building MySql plugin on Mac M1 Qt 6.1.2:

                              /Users/vinceieraci/Qt/6.1.2/Src/qtbase/src/plugins/build-sqldrivers

                              In this directory? I doubt so - configure worked fine so there must be a Makefile or something similar.

                              Qt has to stay free or it will die.

                              V 1 Reply Last reply Reply Quote 0
                              • V
                                Vince2480 @Christian Ehrlicher last edited by

                                @Christian-Ehrlicher No, configure didn't.

                                I want to check we're on the same track.
                                The first step was:

                                qt-cmake -G"Ninja" /users/vinceieraci/qt/6.1.2/Src/qtbase/src/plugins/sqldrivers -DCMAKE_INSTALL_PREFIX=/users/vinceieraci/qt/6.1.2/macos -DMySQL_INCLUDE_DIR="/usr/local/mysql/include" -DMySQL_LIBRARY="/usr/local/mysql/lib/libmysqlclient.dylib"
                                

                                I think that's what you're referring to the configure step, and although the terminal output indicated success, it generated the error log that I posted earlier.

                                jsulm 1 Reply Last reply Reply Quote 0
                                • jsulm
                                  jsulm Lifetime Qt Champion @Vince2480 last edited by

                                  @Vince2480 The Cake call WAS successful (according to your own Make output you posted). Forget the error log.
                                  Do you call make in this folder: /Users/vinceieraci/Qt/6.1.2/Src/qtbase/src/plugins/build-sqldrivers ?

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

                                  1 Reply Last reply Reply Quote 0
                                  • SGaist
                                    SGaist Lifetime Qt Champion last edited by

                                    Hi,

                                    Just to be sure we are all one the same path: Qt 6 documentation:

                                    mkdir build-sqldrivers
                                    cd build-sqldrivers
                                    
                                    qt-cmake -G"Ninja" <qt_installation_path>/Src/qtbase/src/plugins/sqldrivers -DCMAKE_INSTALL_PREFIX=<qt_installation_path>/<platform> -DMySQL_INCLUDE_DIR="/usr/local/mysql/include" -DMySQL_LIBRARY="/usr/local/mysql/lib/libmysqlclient.<so|dylib>"
                                    qt-cmake --build .
                                    qt-cmake --install
                                    

                                    Where did you create build-sqldrivers ?
                                    Did you properly CS into it ?

                                    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 Reply Quote 0
                                    • V
                                      Vince2480 last edited by Vince2480

                                      Thank you everyone so much for staying with me. At age 70, my brain skips what is so obvious, so I’ve spent the last couple of days going over everything I’ve done, and from what I can see, it’s all to the doc.

                                      I’ll detail everything and I hope it will answer everything you're asking me.

                                      This is my default zsh shell path:

                                      vinceieraci@Vinces-MBP2 sqldrivers % echo $PATH                                              
                                      /opt/local/bin:/opt/local/sbin:/opt/homebrew/bin:/opt/homebrew/sbin:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Apple/usr/bin:
                                      

                                      Then I add:

                                      vinceieraci@Vinces-MBP2 sqldrivers export PATH=$PATH:/users/vinceieraci/Qt/6.1.2/macos/bin
                                      

                                      Now start the steps:

                                      vinceieraci@Vinces-MBP2 sqldrivers % mkdir build-sqldrivers
                                      vinceieraci@Vinces-MBP2 sqldrivers % cd build-sqldrivers
                                      vinceieraci@Vinces-MBP2 build-sqldrivers % qt-cmake -G"Ninja" /users/vinceieraci/qt/6.1.2/Src/qtbase/src/plugins/sqldrivers -DCMAKE_INSTALL_PREFIX=/users/vinceieraci/qt/6.1.2/macos -DMySQL_INCLUDE_DIR="/usr/local/mysql/include" -DMySQL_LIBRARY="/usr/local/mysql/lib/libmysqlclient.dylib"
                                      

                                      Files created:
                                      vinceieraci@Vinces-MBP2 build-sqldrivers % ls -l
                                      total 272
                                      -rw-r--r-- 1 vinceieraci staff 47968 5 Aug 09:37 CMakeCache.txt
                                      drwxr-xr-x 13 vinceieraci staff 416 5 Aug 09:37 CMakeFiles
                                      -rw-r--r-- 1 vinceieraci staff 387 5 Aug 09:37 CTestTestfile.cmake
                                      -rw-r--r-- 1 vinceieraci staff 71821 5 Aug 09:37 build.ninja
                                      -rw-r--r-- 1 vinceieraci staff 2034 5 Aug 09:37 cmake_install.cmake
                                      -rw-r--r-- 1 vinceieraci staff 387 5 Aug 09:37 config.summary
                                      drwxr-xr-x 3 vinceieraci staff 96 5 Aug 09:37 lib
                                      drwxr-xr-x 6 vinceieraci staff 192 5 Aug 09:37 mysql
                                      drwxr-xr-x 3 vinceieraci staff 96 5 Aug 09:37 plugins
                                      -rw-r--r-- 1 vinceieraci staff 0 5 Aug 09:37 qtsqldrivers-config.h
                                      -rw-r--r-- 1 vinceieraci staff 261 5 Aug 09:37 qtsqldrivers-config_p.h
                                      drwxr-xr-x 6 vinceieraci staff 192 5 Aug 09:37 sqlite

                                      Hence:

                                      vinceieraci@Vinces-MBP2 build-sqldrivers % make 
                                      make: *** No targets specified and no makefile found.  Stop.
                                      
                                      1 Reply Last reply Reply Quote 0
                                      • SGaist
                                        SGaist Lifetime Qt Champion last edited by

                                        Since you are using the Ninja generator, you have to call ninja to build.

                                        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 Reply Quote 1
                                        • V
                                          Vince2480 @SGaist last edited by Vince2480

                                          @SGaist I'm about give up, it's beyond my abilities.
                                          I'll try again on an Intel machine.

                                          1 Reply Last reply Reply Quote 0
                                          • First post
                                            Last post