Mysql not defined when compiling mysql driver
-
Ok, I understand that.
I am using QtCreator and I have 2 kits. One for MSVC installed with the visual studio build tools 2019 and the other for mingw.
I already use the dedicated command line for MSVC However, in this command line, I have no nmake
. Therefore I have run vcvarsall.bat x64.
This is the output of my config.log
Command line: "MYSQL_INCDIR=C:/mysql/include/" "MYSQL_LIBDIR=C:/mysql/lib/" 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 db2 Trying source 0 (type inline) of library db2 ... sqlcli.h not found in [] and global paths. sqlcli1.h not found in [] and global paths. => source produced no result. Trying source 1 (type inline) of library db2 ... => source failed condition '!config.win32'. test config.sqldrivers.libraries.db2 FAILED looking for library ibase Trying source 0 (type inline) of library ibase ... ibase.h not found in [] and global paths. => source produced no result. Trying source 1 (type inline) of library ibase ... => source failed condition '!config.win32'. test config.sqldrivers.libraries.ibase FAILED 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 ... + cd /d C:\Qt\5.14.2\Src\qtbase\src\plugins\sqldrivers\config.tests\mysql && C:\Qt\5.14.2\msvc2017_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 += mysql" "QMAKE_LIBS_MYSQL = -LC:/mysql/lib/ -llibmysql" "QMAKE_INCDIR_MYSQL = C:/mysql/include/" C:/Qt/5.14.2/Src/qtbase/src/plugins/sqldrivers/config.tests/mysql > Project ERROR: msvc-version.conf loaded but QMAKE_MSC_VER isn't set => source failed verification. Trying source 6 (type inline) of library mysql ... => source failed condition '!config.win32'. test config.sqldrivers.libraries.mysql FAILED looking for library oci Trying source 0 (type inline) of library oci ... oci.h not found in [] and global paths. => source produced no result. Trying source 1 (type inline) of library oci ... => source failed condition '!config.win32'. test config.sqldrivers.libraries.oci FAILED looking for library odbc Trying source 0 (type inline) of library odbc ... sql.h not found in [] and global paths. sqlext.h not found in [] and global paths. => source produced no result. Trying source 1 (type inline) of library odbc ... => source failed condition 'config.darwin'. Trying source 2 (type inline) of library odbc ... => source failed condition '!config.win32 && !config.darwin'. test config.sqldrivers.libraries.odbc FAILED looking for library psql Trying source 0 (type pkgConfig) of library psql ... pkg-config use disabled globally. => source produced no result. Trying source 1 (type psqlConfig) of library psql ... pg_config not found. => source produced no result. Trying source 2 (type psqlEnv) of library psql ... libpq-fe.h not found in [] and global paths. => source produced no result. Trying source 3 (type psqlEnv) of library psql ... => source failed condition '!config.win32'. test config.sqldrivers.libraries.psql FAILED looking for library sqlite2 Trying source 0 (type inline) of library sqlite2 ... sqlite.h not found in [] and global paths. => source produced no result. test config.sqldrivers.libraries.sqlite2 FAILED looking for library tds Trying source 0 (type sybaseEnv) of library tds ... + cd /d C:\Qt\5.14.2\Src\qtbase\src\plugins\sqldrivers\config.tests\tds && C:\Qt\5.14.2\msvc2017_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/5.14.2/Src/qtbase/src/plugins/sqldrivers/config.tests/tds > Project ERROR: msvc-version.conf loaded but QMAKE_MSC_VER isn't set => source failed verification. Trying source 1 (type sybaseEnv) of library tds ... => source failed condition '!config.win32'. test config.sqldrivers.libraries.tds FAILED
-
Ok.
There is a environment setup quide for QT MSCV here:
https://wiki.qt.io/Building_Qt_Desktop_for_Windows_with_MSVCTells you to create a bat file with your environment settings,
There is also a lot you probably do not need to have in here, so just modify to fit your needs, or re-install the qt build kits..@ECHO OFF set DEV=C:set QTDIR=%DEV%set PATH=%SystemRoot%;%SystemRoot%32;%QTDIR% echo Setting OpenSSL Env. set OPENSSL=%DEV%set PATH=%OPENSSL%;%PATH% set LIB=%OPENSSL%set INCLUDE=%OPENSSL% echo Setting NASM Env. set PATH=%DEV%;%PATH% echo Setting DirectX Env. set LIB=%DEV%SDK\Lib\x86;%LIB% set INCLUDE=%DEV%SDK\Include;%INCLUDE% echo Setting Windows SDK Env. set WindowsSdkDir=%DEV%7.1 SDK set PATH=%WindowsSdkDir%;%PATH% set LIB=%WindowsSdkDir%;%LIB% set INCLUDE=%WindowsSdkDir%;%INCLUDE% set TARGET_CPU=x86 echo Setting MSVC2010 Env. set VSINSTALLDIR=%DEV%set VCINSTALLDIR=%DEV%set DevEnvDir=%VSINSTALLDIR%7\IDE set PATH=%VCINSTALLDIR%;%VSINSTALLDIR%7\Tools;%VSINSTALLDIR%7\IDE;%VCINSTALLDIR%;%PATH% set INCLUDE=%VCINSTALLDIR%;%INCLUDE% set LIB=%VCINSTALLDIR%;%LIB% set LIBPATH=%VCINSTALLDIR% echo Setting Framework Env. set FrameworkVersion=v4.0.30319 set Framework35Version=v3.5 set FrameworkDir=%SystemRoot%.NET\Framework set LIBPATH=%FrameworkDir%amp;#37;FrameworkVersion%;%FrameworkDir%amp;#37;Framework35Version%;%LIBPATH% set PATH=%LIBPATH%;%PATH% echo Env. ready. title Qt Framework 4.7.1 Development Kit. cd %DEV%
-
I have added the path to vcvarsall.bat in my path and I ran the command bcvarsall.bat amd64. After this, I have nmake in my path so that's ok.
I deleted the source component and I am making a fresh install now. I will start the compilation of the plugin after that.
-
Hi again,
So, Now i managed to do a proper installation of the plugin I guess. I now have in myC:\Qt\5.14.2\msvc2017_64\plugins\sqldrivers
folder theqsqlmysql.dll
andqsqlmysqld.dll
.I put the
libmysql.dll
in the same directory as my.exe
file but I still have the same problem...Here is part of the output
Cannot load library C:\Qt\5.14.2\msvc2017_64\plugins\sqldrivers\qsqlmysqld.dll: The specified module could not be found.
QLibraryPrivate::loadPlugin failed on "C:/Qt/5.14.2/msvc2017_64/plugins/sqldrivers/qsqlmysqld.dll" : "Cannot load library C:\Qt\5.14.2\msvc2017_64\plugins\sqldrivers\qsqlmysqld.dll: The specified module could not be found."However in the directory it looks in I have the file:
-
What if you now do as I have with my dlls, copy them to build where exe is in a folder sqldrivers.
If that won't work. There should be someone more competent on here that can help.
Everything seems fine to me regarding paths, versions etc.Hope you manage to solve this :)
-
Everything seems to be right with compiler etc, because you get the ddls placed in the correct directories for the MSCV2017..
And since you use same architecture type on both builds there should be noe problem there either..A quick fix for you is to use these:
https://github.com/thecodemonkey86/qt_mysql_driver/releases/tag/qmysql_5.14.2But I suggest that you also check in on this thread to see if someone has answers leading to a permanent fix for future builds.
Or you can try the process again with mingw and see if that gives the same output etc, then at least you know if the environment for mscv is correct if the outputs are the same. -
Everything seems to be right with compiler etc, because you get the ddls placed in the correct directories for the MSCV2017..
And since you use same architecture type on both builds there should be noe problem there either..A quick fix for you is to use these:
https://github.com/thecodemonkey86/qt_mysql_driver/releases/tag/qmysql_5.14.2But I suggest that you also check in on this thread to see if someone has answers leading to a permanent fix for future builds.
Or you can try the process again with mingw and see if that gives the same output etc, then at least you know if the environment for mscv is correct if the outputs are the same.@MEMekaniske Thanks a lot! That works now.
It turns out that it is mylibmysql.dll
file that was not working.
I did different test and I figured out that if I just replace this file by the one provided in the link and keeping all other dll as I built them, it works.
I found mylibmysql.dll
file in the installation folder of my mysql serverC:\Program Files\MySQL\MySQL Server 8.0
. Any idea of what could be wrong about this one? -
That is good :)
Ok, only thing I can think of then is that the MySQL Server 8.0 installed is for a different architecture and cannot be used with amd64, maybe if you just download and install the versions that can be installed on your architecture and try with each of them to see if there is any difference.
If not, I guess it is a bug for the mysql community/support to take a look at
-
@MEMekaniske Thanks a lot! That works now.
It turns out that it is mylibmysql.dll
file that was not working.
I did different test and I figured out that if I just replace this file by the one provided in the link and keeping all other dll as I built them, it works.
I found mylibmysql.dll
file in the installation folder of my mysql serverC:\Program Files\MySQL\MySQL Server 8.0
. Any idea of what could be wrong about this one?@Thombou said in Mysql not defined when compiling mysql driver:
I did different test and I figured out that if I just replace this file by the one provided in the link and keeping all other dll as I built them, it works.
Did you check that the arch matches between the plugin and the client library? I'd hazard a guess that's what was wrong. Anyway, as you have it solved it wouldn't matter that much.
-
@Thombou said in Mysql not defined when compiling mysql driver:
I did different test and I figured out that if I just replace this file by the one provided in the link and keeping all other dll as I built them, it works.
Did you check that the arch matches between the plugin and the client library? I'd hazard a guess that's what was wrong. Anyway, as you have it solved it wouldn't matter that much.
@kshegunov What do you call the client library? The
libmysql.dll
? -
@kshegunov What do you call the client library? The
libmysql.dll
?@Thombou said in Mysql not defined when compiling mysql driver:
What do you call the client library? The libmysql.dll?
Yes!
-
@Thombou said in Mysql not defined when compiling mysql driver:
What do you call the client library? The libmysql.dll?
Yes!
@kshegunov I downloaded it from here https://dev.mysql.com/downloads/windows/installer/8.0.html.
As it is installed in theProgram Files
and not theProgram Files (x86)
directory I'd say it's 64bits...
Plus, this is what I installed so:
-
@kshegunov I downloaded it from here https://dev.mysql.com/downloads/windows/installer/8.0.html.
As it is installed in theProgram Files
and not theProgram Files (x86)
directory I'd say it's 64bits...
Plus, this is what I installed so:
@Thombou It says X64 under the architecture tab so should be the correct version.
-
Also, if you go into the "Add" tab, then expand MySQL Servers, then expand MySQL Server, then choose MySQL Server 8.0 you get the option to choose the availiable architectures :)
-
Yes that's what I di not understand. it seems that I have the correct version but a wrong version of the
libmysql.dll
... Anyway, i hope that it is fixed now, and that I won't have other surprises like that later on.
Thank you very much for your help! It is much appreciated! -
Yes that's what I di not understand. it seems that I have the correct version but a wrong version of the
libmysql.dll
... Anyway, i hope that it is fixed now, and that I won't have other surprises like that later on.
Thank you very much for your help! It is much appreciated!@Thombou Yeah it is very frustrating.. hope all goes well with the next version!
Glad i could help :) -
@Thombou said in Mysql not defined when compiling mysql driver:
Shall I report a bug somewhere of shall I suppose the problem is on my side?
The latter. (And don't feel bad, it happens all the time, that's why this user forum exists)
-
@Thombou said in Mysql not defined when compiling mysql driver:
Shall I report a bug somewhere of shall I suppose the problem is on my side?
The latter. (And don't feel bad, it happens all the time, that's why this user forum exists)
@kshegunov Ok that's what I thought too :) haha. It's by doing that we learn!
Cheers :)