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.1k 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.
  • georgeG Offline
    georgeG Offline
    george
    wrote on last edited by george
    #3

    Thank you for your response.

    When you use MSVC you have to open the correct visual studio command prompt. 
    

    Is this the one shown in the screenshot?
    alt text

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

      Hi,

      If it's the one matching the Qt version used in your Kit then yes.

      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
        #5

        Hi SGaist,
        alt text
        I think it is, because I've installed only the MSVC 64bit compiler
        Therefore it is not the set up of my environment, the reason I cannot build the plugin...

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

          You should check the test logs generated to see what exactly failed when the detection ran.

          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
            #7

            Could you please point me out where I can find these test logs?

            1 Reply Last reply
            0
            • 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 Offline
                      Christian EhrlicherC Offline
                      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 Offline
                                Christian EhrlicherC Offline
                                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

                                          • Login

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