Creating MySQL plugin for QtCreator, mingw73_64 without full Qt recompile.
-
Thanks @Christian-Ehrlicher for your interest.
Yes I did. Not all the posts because its huge. In fact, there is a link to there in my original post. (where I talk about "reimp" and "dlltool")
But, you know...Just readed this post once again. It was opened in my browser while my research. I didn't give credit the last answer.
But... why not try? it's harmless.So:
Now I'm able to connect to FreeRadius MySQLi data base!
4 days.. 4 days reading, testing, frustrating...
And just copying a file did the trick?
Why it's not documented as it's so easy? -
Hi,
@Silderan said in Creating MySQL plugin for QtCreator, mingw73_64 without full Qt recompile.:
Why it's not documented as it's so easy?
Because, while it's working, it's not the correct solution. The dependencies your application uses should either be findable in the
PATH
environment variable or copied in the same folder as your application.This a Windows specific behaviour.
-
Hello @SGaist
(I'm really sorry if you didn't mean this. Sometimes it's hard to me to understand english)
I don't talk about where to put the .dll files.
The point is that two of the .dll needed are already compiled (both, release and debug, are in .../plugins/sqldrivers)
Only needed the libmysql.dll, and this is shiped along with MySQL install.
No need to bulid anything, just copy this .dll in C:\Qt\5.12.0\mingw73_64\binMaybe this is not the correct way as this .dll could not be the correct one and could fail in some scenarios.
Then... will be good if someone can help to compile it correctly. :P
-
If it's working it means that the .dll is compatible so you can just use it. What I meant is that copying .dlls around is the wrong thing to do.
For one reason: if you change your Qt version and the plugin of that version is built with another incompatible version of MySQL, you are going to have a hard time finding why it doesn't load just because you will likely have forgotten that you copied that .dll there.
-
Did you run
qmake
inside the MySQL plugin folder ? -
But, If I'm not wrong, this is because of...:
Also, found this: https://bugreports.qt.io/browse/QTBUG-62174
Sadly, this is far beyond my knowledge.
-
Since configure failed, did you check the reason of the failure ?
-
Found this in config.log:
loaded result for library config.qtbase_sqldrivers.libraries.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.12.0\Src\config.tests\mysql && C:\Qt\5.12.0\Src\qtbase\bin\qmake.exe "CONFIG -= qt debug_and_release app_bundle lib_bundle" "CONFIG += shared warn_off console single_arch" "QMAKE_USE += mysql" "QMAKE_LIBS_MYSQL = -LC:\\mysql/lib -llibmysql" "QMAKE_INCDIR_MYSQL = C:\\mysql/include" C:/Qt/5.12.0/Src/config.tests/mysql + cd /d C:\Qt\5.12.0\Src\config.tests\mysql && set MAKEFLAGS=& mingw32-make > g++ -c -fno-keep-inline-dllexport -g -w -fexceptions -mthreads -DUNICODE -D_UNICODE -DWIN32 -DMINGW_HAS_SECURE_API=1 -I. -IC:\mysql\include -IC:\Qt\5.12.0\Src\qtbase\mkspecs\win32-g++ -o main.o main.cpp > main.cpp:5:10: fatal error: mysql.h: No such file or directory > #include <mysql.h> > ^~~~~~~~~
But I wasn't able to figure out nor why cannot find the header (path is correct) neither how to change it (changing MYSQL_PREFIX=C:\mysql makes no diference. As if this is not the correct syntax)
Furthermore, by executing this three commands out of configure script shows no error:
-
MYSQL_PREFIX
is for Unix like OSes.You should also use forward slashes for your paths.
-
Well then... don't blame me. It's official doc info:
Furthermore I tried forward slashes, backward slashes, double backward...
No change at all :P (Remember what I said... using the same commands out of script, mysql libraries test compiles! Even mixing forward and backward slashes)Anyway, if
MYSQL_PREFIX
is not for Window. Why it is in official doc and witch one must we use? -
Then please re-read said documentation
You have a clear separation with:
How to Build the QMYSQL Plugin on Unix and macOS
and below you have:
How to Build the QMYSQL Plugin on Windows
So the technique for each is well separated.
And you are mixing the information for the configure script or for building using
qmake
. -
Once you said:
@SGaist said in Creating MySQL plugin for QtCreator, mingw73_64 without full Qt recompile.:
Since configure failed, did you check the reason of the failure ?
I figure out that I must run a success configure at first. Sorry for the confusion. My lasts posts were about configure tool, not building the plugins.
I'm not able to figure out the reason of the failure. Seems like test code is not able to get the header files, as if the headers don't exists or the include path is wrong. But my "out of the box" tests works.Anyway, I even tried
MYSQL_INCDIR
andMYSQL_LIBDIR
instead of *_PREFIX in configure step. Same result:Sorry again for not been clear enough.
-
One thing you can try is to use the "-I" and "-L" options of the configure script passing there the paths to your MySQL include and library folder.