Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. How to patch 'QSqlDatabase::open always returns true with QMYSQL'
QtWS25 Last Chance

How to patch 'QSqlDatabase::open always returns true with QMYSQL'

Scheduled Pinned Locked Moved Installation and Deployment
qsqldatabasecmakearchlinuxclion-ide
8 Posts 2 Posters 3.4k 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.
  • R Offline
    R Offline
    richin13
    wrote on last edited by
    #1

    Hi, I'am currently developing an application using Clion as IDE which uses CMake to build the project. For my project I will need to use a MySQL db using Qt5 libraries. Earlier I found that a bug affects QSqlDatabase when using the QMYSQL driver. Also found that is already patched in version 5.5.1, however the package provided by my Os (ArchLinux) is version 5.5.0

    How can I apply the 5.5.1 patch so that my current CMakeLists.txt keep it running.
    If that isn't possible, how can I make CMake or Clion to look up all the qt5 libraries in the directory that Qt5 installer created?

    Thanks in advance.

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

      Hi and welcome to devnet,

      You can either clone the qtbase sources and checkout the 5.5.1 branch or get the patch here and apply it to your sources

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

        Hello Mr. Gaist thank you for the response.
        I went through the first option, after following every step in this guide still cannot make QSqlDatabase to work. I assume CMake still seeks for Qt libraries at /usr/include|/usr/lib and not into /usr/local/Qt-5.5.1
        Do I have to change anything else in order to make it work. I tried to uninstall qt5-base package with no success because it is a dependency of another packages.

        Edit:

        [ricardo@ricardo-desktop ~]$ whereis qmake
        qmake: /usr/bin/qmake /usr/local/Qt-5.5.1/bin/qmake
        
        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          Are you using CMake or qmake for your application ? If the former then you need to tell CMake where to look for Qt. CMake doesn't use qmake at all.

          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
          • R Offline
            R Offline
            richin13
            wrote on last edited by richin13
            #5

            I am using CMake. The qmake example was to show that Qt 5.5.1 is installed but also Qt 5.5.0 is and CMake keeps choosing the latter.

            Can you point how to tell CMake to look for Qt in the right directory?
            I was trying to follow the official documentation and specifically this step which I think is the one I need in order to tell CMake where to look

            find_package(Qt5Core)
            
            get_target_property(QtCore_location Qt5::Core LOCATION)
            

            However, I can't figure out what LOCATION means or how could I replace the right path there and I haven't found anything useful in google so far. I followed this link where LOCATION property is explained but I still cannot figure it out. Note that I am kinda newbie using CMake and Qt.

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

              You can add the minimum version of Qt you want if cmake does find several versions

              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
              • R Offline
                R Offline
                richin13
                wrote on last edited by
                #7

                Thank you very much. Today, the Qt version 5.5.1 was pushed to the official ArchLinux's repositories. The problem is gone.

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

                  You're welcome !

                  Since everything is working now, please mark the thread as solved so other forum users may know a solution has been found :)

                  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