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. Creating MySQL plugin for QtCreator, mingw73_64 without full Qt recompile.

Creating MySQL plugin for QtCreator, mingw73_64 without full Qt recompile.

Scheduled Pinned Locked Moved Unsolved General and Desktop
pluginsmysql 64bit
16 Posts 3 Posters 2.6k 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.
  • S Offline
    S Offline
    Silderan
    wrote on last edited by Silderan
    #1

    Hello.

    I've been reading many posts regarding this, but I have some troubles understanding the whole.

    In Qt doc says to make a MySQL "custom install" but there is no "Libs & Include Files" option in their wizard (neither download option in the website). Maybe it's outdated.
    Actually, there is the option for install Connectors.
    Is the "Connectors" the correct MySQL install option?

    There are 3 connectors: C++ 64 bits, C 32 and C64 bits.
    I choose C++... as Qt is for C++, but saw in another post chossing C 32bits connector and nobody says it was wrong.
    What are the correct connector for Qt 64 bits?

    Seems that everything in MySQL is for MSVC compiler. Am I correct?
    Do I need to convert it to mingw-like libraries (.a, if not wrong)? Are the "reimp" and "dlltool" mingw tools, as stated in this post, the way?
    If it's true, why there is nothing about it in Qt Doc?

    In Qt Docs, also, there is some texts with the path where the libs and headers should be installed by default by MySQL wizard. This path is something like MySQL/server..../
    For this reason, I tried to install server, but the libs and headers in there seems not the correct ones.
    Actually, I tried installing server, C++ 8.0 connector and C 6.1 64 bits connector. But the command

    configure -sql-mysql MYSQL_PREFIX=C:\mysql
    

    reports allways that cannot find mysql header/libs:
    ERROR: Feature 'sql-mysql' was enabled, but the pre-condition 'libs.mysql' failed.

    I would like to compile just the driver.
    When running this command:

    qmake -- MYSQL_INCDIR="c:\mysql\include" MYSQL_LIBDIR="c:\mysql\lib"
    

    I get this error msg:
    Project ERROR: You cannot configure sqldrivers separately within a top-level build.
    What are the steps for compiling just the driver? I cannot find how to do it.

    Thank you.

    1 Reply Last reply
    0
    • Christian EhrlicherC Online
      Christian EhrlicherC Online
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Did you read https://forum.qt.io/topic/40672 ?

      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
      • S Offline
        S Offline
        Silderan
        wrote on last edited by
        #3

        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:
        0_1549201535881_FreeRadiusBrowsing.PNG

        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?

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          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.

          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
          1
          • S Offline
            S Offline
            Silderan
            wrote on last edited by
            #5

            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\bin

            Maybe 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

            1 Reply Last reply
            0
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #6

              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.

              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
              2
              • S Offline
                S Offline
                Silderan
                wrote on last edited by Silderan
                #7

                Agree. But...
                What about my original question(s)? XD
                Solving this, I will be closer to compile and won't be worried about .dll version mismatch. ;)

                1 Reply Last reply
                0
                • SGaistS Offline
                  SGaistS Offline
                  SGaist
                  Lifetime Qt Champion
                  wrote on last edited by
                  #8

                  Did you run qmake inside the MySQL plugin folder ?

                  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
                  0
                  • S Offline
                    S Offline
                    Silderan
                    wrote on last edited by
                    #9

                    0_1549725440560_faff53a0-5191-47d3-a29f-523beaa31968-image.png

                    0_1549725545070_872f646e-f20f-4e5b-9f8a-2785e7cc7957-image.png

                    But, If I'm not wrong, this is because of...:
                    0_1549729529972_b3181c5a-95bc-419c-8d6a-283e08b84c97-image.png
                    0_1549729557180_a0c0d31a-9630-4948-8891-f1f440b20127-image.png

                    Also, found this: https://bugreports.qt.io/browse/QTBUG-62174

                    Sadly, this is far beyond my knowledge.

                    1 Reply Last reply
                    0
                    • SGaistS Offline
                      SGaistS Offline
                      SGaist
                      Lifetime Qt Champion
                      wrote on last edited by
                      #10

                      Since configure failed, did you check the reason of the failure ?

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

                      S 1 Reply Last reply
                      0
                      • S Offline
                        S Offline
                        Silderan
                        wrote on last edited by
                        #11

                        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:
                        0_1549791602319_2e7ad380-4e1b-4a4b-9f9c-639fc47bc023-image.png

                        1 Reply Last reply
                        0
                        • SGaistS Offline
                          SGaistS Offline
                          SGaist
                          Lifetime Qt Champion
                          wrote on last edited by SGaist
                          #12

                          MYSQL_PREFIX is for Unix like OSes.

                          You should also use forward slashes for your paths.

                          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
                          0
                          • S Offline
                            S Offline
                            Silderan
                            wrote on last edited by Silderan
                            #13

                            Well then... don't blame me. It's official doc info:

                            0_1549835061467_c0fdb3bc-30f2-4baa-be38-cdbd64a1a628-image.png

                            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?

                            1 Reply Last reply
                            0
                            • SGaistS Offline
                              SGaistS Offline
                              SGaist
                              Lifetime Qt Champion
                              wrote on last edited by
                              #14

                              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.

                              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
                              1
                              • SGaistS SGaist

                                Since configure failed, did you check the reason of the failure ?

                                S Offline
                                S Offline
                                Silderan
                                wrote on last edited by Silderan
                                #15

                                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 and MYSQL_LIBDIR instead of *_PREFIX in configure step. Same result:

                                Sorry again for not been clear enough.

                                1 Reply Last reply
                                0
                                • SGaistS Offline
                                  SGaistS Offline
                                  SGaist
                                  Lifetime Qt Champion
                                  wrote on last edited by
                                  #16

                                  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.

                                  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
                                  0

                                  • Login

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