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. Cannot build MySQL plugin
Forum Updated to NodeBB v4.3 + New Features

Cannot build MySQL plugin

Scheduled Pinned Locked Moved Solved General and Desktop
24 Posts 4 Posters 2.3k Views 3 Watching
  • 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.
  • SGaistS Offline
    SGaistS Offline
    SGaist
    Lifetime Qt Champion
    wrote on last edited by
    #8

    In the folder where you call 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
    0
    • georgeG Offline
      georgeG Offline
      george
      wrote on last edited by george
      #9
      In the folder where you call qmake.
      

      I call the qmake from the folder:
      C:\Qt\5.14.2\Src\qtbase\src\plugins\sqldrivers\mysql
      In the following image there is a list of all files. There is no log files there (all subfolders are empty)
      alt text

      http://www.mediafire.com/view/vgec6rp2ldmf9lh/qt%25235.jpg/file

      kshegunovK 1 Reply Last reply
      0
      • georgeG george
        In the folder where you call qmake.
        

        I call the qmake from the folder:
        C:\Qt\5.14.2\Src\qtbase\src\plugins\sqldrivers\mysql
        In the following image there is a list of all files. There is no log files there (all subfolders are empty)
        alt text

        http://www.mediafire.com/view/vgec6rp2ldmf9lh/qt%25235.jpg/file

        kshegunovK Offline
        kshegunovK Offline
        kshegunov
        Moderators
        wrote on last edited by kshegunov
        #10

        Hi,
        Open the .pro file for the plugin and change the line which reads:

        QMAKE_USE += mysql
        

        to:

        # QMAKE_USE += mysql
        

        Then rerun qmake and build with make/nmake. Then you can see what the compiler complained about exactly. Do let us know, I had that problem compiling psql because I mixed the arch by accident.

        Read and abide by the Qt Code of Conduct

        1 Reply Last reply
        0
        • georgeG Offline
          georgeG Offline
          george
          wrote on last edited by george
          #11

          Hi kshegunov,
          Although I don't know what the QMAKE_USE += mysql instruction does, I understand that the '#' symbol is for remarks
          I followed your instruction.
          From the command prompt, I am getting no messages, so I opened the project from the creator and there are no errors.
          The compiler output window among other displays something about "win32-msvc", but I've the 64bit version installed:

          20:06:46: Running steps for project mysql...
          20:06:46: Starting: "C:\Qt\5.14.2\msvc2017_64\bin\qmake.exe" C:\Qt\5.14.2\Src\qtbase\src\plugins\sqldrivers\mysql\mysql.pro -spec win32-msvc "CONFIG+=debug" "CONFIG+=qml_debug"
          

          In the following image you can see the full compiler output
          alt text
          http://www.mediafire.com/view/vfi179q0efuqh5t/qt%25236.jpg/file
          But if everything is OK, where is the plugin? I searched for a ".dll" file in the subfolders but all they are empty

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

            You did not follow the documentation - you have to run qmake in the sqldrivers subdir...

            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
            0
            • georgeG george

              Hi kshegunov,
              Although I don't know what the QMAKE_USE += mysql instruction does, I understand that the '#' symbol is for remarks
              I followed your instruction.
              From the command prompt, I am getting no messages, so I opened the project from the creator and there are no errors.
              The compiler output window among other displays something about "win32-msvc", but I've the 64bit version installed:

              20:06:46: Running steps for project mysql...
              20:06:46: Starting: "C:\Qt\5.14.2\msvc2017_64\bin\qmake.exe" C:\Qt\5.14.2\Src\qtbase\src\plugins\sqldrivers\mysql\mysql.pro -spec win32-msvc "CONFIG+=debug" "CONFIG+=qml_debug"
              

              In the following image you can see the full compiler output
              alt text
              http://www.mediafire.com/view/vfi179q0efuqh5t/qt%25236.jpg/file
              But if everything is OK, where is the plugin? I searched for a ".dll" file in the subfolders but all they are empty

              kshegunovK Offline
              kshegunovK Offline
              kshegunov
              Moderators
              wrote on last edited by
              #13

              @george said in Cannot build MySQL plugin:

              From the command prompt, I am getting no messages, so I opened the project from the creator and there are no errors.

              You didn't invoke the generated makefile as far as I could see from your screenshot. So I wouldn't expect you to see any messages. ;) After you run the qmake, you do need to call nmake to start things rolling.

              @Christian-Ehrlicher said in Cannot build MySQL plugin:

              You did not follow the documentation - you have to run qmake in the sqldrivers subdir...

              True, but don't lose patience on us. He just tried to follow what I asked, have some faith. ;)

              Read and abide by the Qt Code of Conduct

              1 Reply Last reply
              0
              • georgeG Offline
                georgeG Offline
                george
                wrote on last edited by george
                #14

                First of all, I would like to thank you for spending your valuable time, reading my posts and try to guide me.
                It is true that I went a step forward. First I ran the vcvarsall.bat (I did not execute this batch file before). I suppose that sets some environment variables, right?
                From the command prompt and in the following directory: "C:/Qt/15.4.2/Src/qtbase/src/sqldrivers" I build the plugin as follows:

                qmake -- MYSQL_INCDIR="C:/Program Files/MySQL/MySQL Connector C 6.1/include" MYSQL_LIBDIR="C:/Program Files/MySQL/MySQL Connector C 6.1/lib"
                

                Here is the output:
                alt text
                http://www.mediafire.com/view/swazfssbaa0dg2u/qt%25237.jpg/file
                But what is the next step?
                If I enter:

                nmake sub-mysql
                

                as manual says, I am getting the following errors:

                Microsoft (R) Program Maintenance Utility Version 14.16.27035.0
                Copyright (C) Microsoft Corporation.  All rights reserved.
                
                        cd mysql\ && ( if not exist Makefile C:\Qt\5.14.2\msvc2017_64\bin\qmake.exe -o Makefile C:\Qt\5.14.2\Src\qtbase\src\plugins\sqldrivers\mysql\mysql.pro ) && "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\bin\HostX64\x64\nmake.exe" -f Makefile
                
                Microsoft (R) Program Maintenance Utility Version 14.16.27035.0
                Copyright (C) Microsoft Corporation.  All rights reserved.
                
                        "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\bin\HostX64\x64\nmake.exe" -f Makefile.Release all
                
                Microsoft (R) Program Maintenance Utility Version 14.16.27035.0
                Copyright (C) Microsoft Corporation.  All rights reserved.
                
                        link /NOLOGO /DYNAMICBASE /NXCOMPAT /DEBUG /OPT:REF /INCREMENTAL:NO /DLL /SUBSYSTEM:WINDOWS /VERSION:5.14 /OUT:..\plugins\sqldrivers\qsqlmysql.dll @C:\Users\George\AppData\Local\Temp\nmEA57.tmp
                LINK : fatal error LNK1181: cannot open input file 'lmysql.obj'
                NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\bin\HostX64\x64\link.EXE"' : return code '0x49d'
                Stop.
                NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\bin\HostX64\x64\nmake.exe"' : return code '0x2'
                Stop.
                NMAKE : fatal error U1077: 'cd' : return code '0x2'
                Stop.
                
                kshegunovK 1 Reply Last reply
                0
                • georgeG george

                  First of all, I would like to thank you for spending your valuable time, reading my posts and try to guide me.
                  It is true that I went a step forward. First I ran the vcvarsall.bat (I did not execute this batch file before). I suppose that sets some environment variables, right?
                  From the command prompt and in the following directory: "C:/Qt/15.4.2/Src/qtbase/src/sqldrivers" I build the plugin as follows:

                  qmake -- MYSQL_INCDIR="C:/Program Files/MySQL/MySQL Connector C 6.1/include" MYSQL_LIBDIR="C:/Program Files/MySQL/MySQL Connector C 6.1/lib"
                  

                  Here is the output:
                  alt text
                  http://www.mediafire.com/view/swazfssbaa0dg2u/qt%25237.jpg/file
                  But what is the next step?
                  If I enter:

                  nmake sub-mysql
                  

                  as manual says, I am getting the following errors:

                  Microsoft (R) Program Maintenance Utility Version 14.16.27035.0
                  Copyright (C) Microsoft Corporation.  All rights reserved.
                  
                          cd mysql\ && ( if not exist Makefile C:\Qt\5.14.2\msvc2017_64\bin\qmake.exe -o Makefile C:\Qt\5.14.2\Src\qtbase\src\plugins\sqldrivers\mysql\mysql.pro ) && "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\bin\HostX64\x64\nmake.exe" -f Makefile
                  
                  Microsoft (R) Program Maintenance Utility Version 14.16.27035.0
                  Copyright (C) Microsoft Corporation.  All rights reserved.
                  
                          "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\bin\HostX64\x64\nmake.exe" -f Makefile.Release all
                  
                  Microsoft (R) Program Maintenance Utility Version 14.16.27035.0
                  Copyright (C) Microsoft Corporation.  All rights reserved.
                  
                          link /NOLOGO /DYNAMICBASE /NXCOMPAT /DEBUG /OPT:REF /INCREMENTAL:NO /DLL /SUBSYSTEM:WINDOWS /VERSION:5.14 /OUT:..\plugins\sqldrivers\qsqlmysql.dll @C:\Users\George\AppData\Local\Temp\nmEA57.tmp
                  LINK : fatal error LNK1181: cannot open input file 'lmysql.obj'
                  NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\bin\HostX64\x64\link.EXE"' : return code '0x49d'
                  Stop.
                  NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\bin\HostX64\x64\nmake.exe"' : return code '0x2'
                  Stop.
                  NMAKE : fatal error U1077: 'cd' : return code '0x2'
                  Stop.
                  
                  kshegunovK Offline
                  kshegunovK Offline
                  kshegunov
                  Moderators
                  wrote on last edited by
                  #15

                  @george said in Cannot build MySQL plugin:

                  LINK : fatal error LNK1181: cannot open input file 'lmysql.obj'

                  Do you by any chance use a statically built Qt? This linker error is rather odd.

                  Read and abide by the Qt Code of Conduct

                  1 Reply Last reply
                  0
                  • georgeG Offline
                    georgeG Offline
                    george
                    wrote on last edited by
                    #16

                    @kshegunov said in Cannot build MySQL plugin:

                    Do you by any chance use a statically built Qt?

                    Hmm... How can I check this?
                    I searched my entire hard drive for the file "lmysql.obj", but I found nothing

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

                      Please make sure that there are no leftovers in the sqldrivers subdir (best is to remove this subdir and unpack it again) and try again.

                      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
                      • georgeG george

                        @kshegunov said in Cannot build MySQL plugin:

                        Do you by any chance use a statically built Qt?

                        Hmm... How can I check this?
                        I searched my entire hard drive for the file "lmysql.obj", but I found nothing

                        kshegunovK Offline
                        kshegunovK Offline
                        kshegunov
                        Moderators
                        wrote on last edited by
                        #18

                        @george said in Cannot build MySQL plugin:

                        I searched my entire hard drive for the file "lmysql.obj", but I found nothing

                        Hence I was suspicious. How did you obtain the sources, did you clone them from git or unpacked them from an archive, or maybe installed them through the maintenance tool? Christian's advice is a good one at this point, you want to make sure there are no leftovers because that can break the build.

                        Read and abide by the Qt Code of Conduct

                        1 Reply Last reply
                        0
                        • georgeG Offline
                          georgeG Offline
                          george
                          wrote on last edited by
                          #19

                          I'll uninstall the Qt entirely and I'll delete the Qt folder.
                          Then, I'll install from scratch the SDK using the online installer (only the MSVC 64 bit compiler)
                          Then I'll let you know since the installation will take some time.

                          kshegunovK 1 Reply Last reply
                          0
                          • georgeG george

                            I'll uninstall the Qt entirely and I'll delete the Qt folder.
                            Then, I'll install from scratch the SDK using the online installer (only the MSVC 64 bit compiler)
                            Then I'll let you know since the installation will take some time.

                            kshegunovK Offline
                            kshegunovK Offline
                            kshegunov
                            Moderators
                            wrote on last edited by
                            #20

                            Sounds like a plan.

                            @george said in Cannot build MySQL plugin:

                            Then, I'll install from scratch the SDK using the online installer (only the MSVC 64 bit compiler)

                            One one note here, make sure that the SDK architecture (and compiler) you select matches the one of your command prompt that you're going to use. I had experienced this cryptic error when I tried to compile the PSQL driver with a 64 bit msvc, while my Qt distro was for 32 bit msvc. I know it sounds silly but it's an easy error to make, and not very obvious if you actually make it.

                            Read and abide by the Qt Code of Conduct

                            1 Reply Last reply
                            0
                            • georgeG Offline
                              georgeG Offline
                              george
                              wrote on last edited by george
                              #21

                              @kshegunov said in Cannot build MySQL plugin:

                              make sure that the SDK architecture (and compiler) you select matches the one of your command prompt that you're going to use

                              I noticed that the installer, creates only those command prompts shortcuts in the windows start menu that they correspond to the compiler versions chosen during the installation.
                              I choose only one compiler to avoid such errors. When I will get better knowledge of how Qt works then, I'll proceed with other compilers too

                              1 Reply Last reply
                              0
                              • georgeG Offline
                                georgeG Offline
                                george
                                wrote on last edited by
                                #22

                                Now I have a fresh installation of Qt in my hard drive
                                Before I start, I am wondering if I have to modify the project file

                                mysql.pro
                                

                                in the following folder:

                                C:\Qt\5.14.2\Src\qtbase\src\plugins\sqldrivers\mysql
                                

                                as I did in my first post. I had added the following lines:

                                INCLUEPATH += C:/Program Files/MySQL/MySQL Connector C 6.1/include
                                QMAKE_LIBDIR += C:/Program Files/MySQL/MySQL Connector C 6.1/lib
                                LIBS += -lmysql
                                
                                kshegunovK 1 Reply Last reply
                                0
                                • georgeG george

                                  Now I have a fresh installation of Qt in my hard drive
                                  Before I start, I am wondering if I have to modify the project file

                                  mysql.pro
                                  

                                  in the following folder:

                                  C:\Qt\5.14.2\Src\qtbase\src\plugins\sqldrivers\mysql
                                  

                                  as I did in my first post. I had added the following lines:

                                  INCLUEPATH += C:/Program Files/MySQL/MySQL Connector C 6.1/include
                                  QMAKE_LIBDIR += C:/Program Files/MySQL/MySQL Connector C 6.1/lib
                                  LIBS += -lmysql
                                  
                                  kshegunovK Offline
                                  kshegunovK Offline
                                  kshegunov
                                  Moderators
                                  wrote on last edited by
                                  #23

                                  @george said in Cannot build MySQL plugin:

                                  Before I start, I am wondering if I have to modify the project file

                                  You shouldn't.

                                  I had added the following lines

                                  Don't do that, you provide the paths on the command line, as per the documentation. Don't forget to quote the paths, as they contain spaces.

                                  Read and abide by the Qt Code of Conduct

                                  1 Reply Last reply
                                  2
                                  • georgeG Offline
                                    georgeG Offline
                                    george
                                    wrote on last edited by george
                                    #24

                                    Well, I managed to connect with my database, thanks to all the people they responded to my posts, and especially to you kshegunov
                                    alt text

                                    The most important reason that I've never used the QT, it is I never manage to connect with a remote database. Now I can use and learn this SDK which I believe it is the most comprehensive SDK around C++, targeting to database applications for my personal needs

                                    For people like me who does not have good knowledge around Qt I will post the steps I followed:

                                    1. Make a fresh install of Qt BUT only one compiler (if you do not know what are you doing!). I choosed the MSVC 2017 64bit. I installed the QT in C:\Qt
                                      alt text
                                      alt text

                                    2. Install the MySQL Connector . I installed in C:\Program Files\MySQL\MySQL Connector 6.1

                                    3. Click on the Windows start menu the shortcut for the command prompt of MSVC 2017 64-bit
                                      alt text

                                    4. Find in your hard drive the file vcvarsall.bat and execute it (you sould have Microsoft Visual Studio 2017 installed on your hard drive)
                                      alt text

                                    5. Go to the C:\Qt\5.14.2\Src\qtbase\src\plugins\sqldrivers and execute the following command (according to Qt manual)

                                    qmake -- MYSQL_INCDIR="C:/Program Files/MySQL/MySQL Connector C 6.1/include" MYSQL_LIBDIR="C:/Program Files/MySQL/MySQL Connector C 6.1/lib"
                                    

                                    and then

                                    nmake
                                    

                                    and then

                                    nmake install
                                    

                                    You'll see a lot of output. If everything is OK you should see the following files:
                                    qsqlmysql.dll and qsqlmysqld.dll
                                    in the folder C:\Qt\5.14.2\msvc2017_64\plugins\sqldrivers (see the first image of this post)

                                    1 Reply Last reply
                                    2

                                    • Login

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