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. Can not find mysql when executing `qmake`
Forum Update on Monday, May 27th 2025

Can not find mysql when executing `qmake`

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 3 Posters 713 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.
  • V Offline
    V Offline
    voldikss
    wrote on 26 May 2020, 03:53 last edited by
    #1

    Hello everyone. This problem hungs for two days for me. And any helps will be appreciated.

    I have installed MySQL 8.0.20 in my Windows. I've also added it's path to the enviroment.
    c405e16a-bdbd-4df0-ace3-800007933400-image.png

    My Qt version is 5.14.2. I want to build mysql driver by myself. So I go to the directory C:\Qt\Qt5.14.2\5.14.2\Src\qtbase\src\plugins\sqldrivers.

    This is the sqldrivers.pro:

    TEMPLATE = subdirs
    
    
    INCLUDEPATH += "C:/Program Files/MySQL/MySQL Server 8.0/include"
    LIBS += "C:/Program Files/MySQL/MySQL Server 8.0/lib/libmysql.lib"
    
    sqldrivers_standalone {
        _QMAKE_CACHE_ = $$shadowed($$SQLDRV_SRC_TREE)/.qmake.conf
        load(qt_configure)
    }
    
    qtConfig(sql-psql)     : SUBDIRS += psql
    qtConfig(sql-mysql)    : SUBDIRS += mysql
    qtConfig(sql-odbc)     : SUBDIRS += odbc
    qtConfig(sql-tds)      : SUBDIRS += tds
    qtConfig(sql-oci)      : SUBDIRS += oci
    qtConfig(sql-db2)      : SUBDIRS += db2
    qtConfig(sql-sqlite)   : SUBDIRS += sqlite
    qtConfig(sql-sqlite2)  : SUBDIRS += sqlite2
    qtConfig(sql-ibase)    : SUBDIRS += ibase
    

    I ran qmake and got the following messages:

    Command line:
    Global lib dirs: [C:\\openssl\\lib C:\\Utils\\my_sql\\mysql-5.7.25-winx64\\lib C:\\Utils\\postgresql\\pgsql\\lib] []
    Global inc dirs: [C:\\openssl\\include C:\\Utils\\my_sql\\mysql-5.7.25-winx64\\include C:\\Utils\\postgresql\\pgsql\\include] []
    looking for library mysql
    Trying source 0 (type mysqlConfig) of library mysql ...
    mysql_config not found.
      => source produced no result.
    Trying source 1 (type mysqlConfig) of library mysql ...
    mysql_config not found.
      => source produced no result.
    Trying source 2 (type mysqlConfig) of library mysql ...
    mysql_config not found.
      => source produced no result.
    Trying source 3 (type mysqlConfig) of library mysql ...
    mysql_config not found.
      => source produced no result.
    Trying source 4 (type inline) of library mysql ...
      => source failed condition '!config.win32'.
    Trying source 5 (type inline) of library mysql ...
    mysql.h not found in [] and global paths.
      => source produced no result.
    Trying source 6 (type inline) of library mysql ...
      => source failed condition '!config.win32'.
    test config.sqldrivers.libraries.mysql FAILED
    + cd /d C:\Qt\Qt5.14.2\5.14.2\Src\qtbase\src\plugins\sqldrivers\config.tests\tds && C:\Qt\Qt5.14.2\5.14.2\msvc2015_64\bin\qmake.exe "CONFIG -= qt debug_and_release app_bundle lib_bundle" "CONFIG += shared warn_off console single_arch" "QMAKE_LIBDIR += C:\\openssl\\lib C:\\Utils\\my_sql\\mysql-5.7.25-winx64\\lib C:\\Utils\\postgresql\\pgsql\\lib" "INCLUDEPATH += C:\\openssl\\include C:\\Utils\\my_sql\\mysql-5.7.25-winx64\\include C:\\Utils\\postgresql\\pgsql\\include" "QMAKE_USE += tds" "QMAKE_LIBS_TDS = -lNTWDBLIB" C:/Qt/Qt5.14.2/5.14.2/Src/qtbase/src/plugins/sqldrivers/config.tests/tds
    + cd /d C:\Qt\Qt5.14.2\5.14.2\Src\qtbase\src\plugins\sqldrivers\config.tests\tds && set MAKEFLAGS=& nmake clean && set MAKEFLAGS=& nmake
    > Microsoft (R) Program Maintenance Utility Version 14.00.24210.0
    > Copyright (C) Microsoft Corporation.  All rights reserved.
    > 	del main.obj
    > can not found C:\Qt\Qt5.14.2\5.14.2\Src\qtbase\src\plugins\sqldrivers\config.tests\tds\main.obj
    > Microsoft (R) Program Maintenance Utility Version 14.00.24210.0
    > Copyright (C) Microsoft Corporation.  All rights reserved.
    > 	cl -c -nologo -Zc:wchar_t -FS -Zc:rvalueCast -Zc:inline -Zc:strictStrings -Zc:throwingNew -O2 -MD -W0 -EHsc -DUNICODE -D_UNICODE -DWIN32 -D_ENABLE_EXTENDED_ALIGNED_STORAGE -DWIN64 -DNDEBUG -I. -IC:\openssl\include -IC:\Utils\my_sql\mysql-5.7.25-winx64\include -IC:\Utils\postgresql\pgsql\include -IC:\Qt\Qt5.14.2\5.14.2\msvc2015_64\mkspecs\win32-msvc -Fo @C:\Users\voldikss\AppData\Local\Temp\nmE3C8.tmp
    > main.cpp
    > .\main.cpp(2): fatal error C1083: Cannot open include file: 'sybfront.h': No such file or directory
    > NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\cl.EXE"' : return code '0x2'
    > Stop.
     => source failed verification.
    Trying source 1 (type sybaseEnv) of library tds ...
      => source failed condition '!config.win32'.
    test config.sqldrivers.libraries.tds FAILED
    
    1 Reply Last reply
    0
    • C Offline
      C Offline
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on 26 May 2020, 04:35 last edited by
      #2

      Please follow the documentation instead doing some other strange stuff

      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
      1
      • V Offline
        V Offline
        voldikss
        wrote on 26 May 2020, 07:26 last edited by voldikss
        #3

        Thank you for the reply.

        Actually I followed the doc described here. Instead pass include and lib through command line, I wrote them in the .pro file. But I failed at the very first step(Checking for mysql .......no).

        Also I tried qmake -- MYSQL_INCDIR="C:/Program Files/MySQL/MySQL Server 8.0/include" MYSQL_LIBDIR="C:/Program Files/MySQL/MySQL Server 8.0/lib", still failed to check for mysql.

        1 Reply Last reply
        0
        • B Offline
          B Offline
          Bonnie
          wrote on 26 May 2020, 08:13 last edited by Bonnie
          #4

          If you are sure there exists mysql.h in your "C:/Program Files/MySQL/MySQL Server 8.0/include", then before running qmake again, try deleting config.cache file.
          Don't change .pro file, no need to pass include and lib to it, just run that qmake -- MYSQL_INCDIR="..." MYSQL_LIBDIR="..."

          P.S. For later convenience (avoiding the loading problem), if you are not using MSVC2015 version of Qt, I recommand that do not use libmysql.dll from MySQL 5.7.18+ / 8.0 or MySQL Connector C 6.1.10+, using older instead.
          You can download MySQL Connector C 6.1.9 from:
          https://downloads.mysql.com/archives/c-c/
          Or download MySQL Server 5.7.17 archive files from:
          https://downloads.mysql.com/archives/community/
          (5.7.17 also can be installed from MySQL Installer)

          1 Reply Last reply
          1

          1/4

          26 May 2020, 03:53

          • Login

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