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. install mysql driver for Qt5.12.4
Forum Updated to NodeBB v4.3 + New Features

install mysql driver for Qt5.12.4

Scheduled Pinned Locked Moved Unsolved General and Desktop
8 Posts 2 Posters 2.1k 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.
  • M Offline
    M Offline
    montanaviking
    wrote on last edited by
    #1

    I was attempting to install the mysql driver for Qt5.12.4 on Ubuntu 18.04 64-bit. Attempting to run
    #./configure -plugin-sql-mysql
    gives me the following error:
    ERROR: Feature 'sql-mysql' was enabled, but the pre-condition 'libs.mysql' failed.
    It appears that there are dependencies I don't have but how to know which ones they are?
    Google has not provided an answer for me.
    Thanks so much in advance!
    Phil

    jsulmJ 1 Reply Last reply
    0
    • M montanaviking

      I was attempting to install the mysql driver for Qt5.12.4 on Ubuntu 18.04 64-bit. Attempting to run
      #./configure -plugin-sql-mysql
      gives me the following error:
      ERROR: Feature 'sql-mysql' was enabled, but the pre-condition 'libs.mysql' failed.
      It appears that there are dependencies I don't have but how to know which ones they are?
      Google has not provided an answer for me.
      Thanks so much in advance!
      Phil

      jsulmJ Online
      jsulmJ Online
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @montanaviking said in install mysql driver for Qt5.12.4:

      how to know which ones they are?

      Add -v parameter to configure call and take a closer look at build log.
      You probably did not install mysql-dev package.

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      2
      • M Offline
        M Offline
        montanaviking
        wrote on last edited by
        #3

        Hi jsulm,
        Thanks for your response.
        I have the following installed (ubuntu 18.04 repository):

        libmysqlclient20
        libmysqld-dev
        but still getting the above error.
        Thanks,
        Phil

        jsulmJ 1 Reply Last reply
        0
        • M montanaviking

          Hi jsulm,
          Thanks for your response.
          I have the following installed (ubuntu 18.04 repository):

          libmysqlclient20
          libmysqld-dev
          but still getting the above error.
          Thanks,
          Phil

          jsulmJ Online
          jsulmJ Online
          jsulm
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @montanaviking I think you need libmysqlclient-dev not libmysqld-dev.
          And as I suggested adding -v parameter to configure can give you more information about what is missing.

          https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          2
          • M Offline
            M Offline
            montanaviking
            wrote on last edited by
            #5

            Hi Jsulm,
            I'll try your suggestions. However, I was able to get the mysql library to load via:

            1. Installed the Qt5.12.4 package again in another directory, i.e. /opt/QtLTS
            2. ran ./configure -sql-mysql in the /opt/QtLTS/5.12.4/Src directory (as root)
            3. make install

            The above took several hours.
            New code was then installed in my /usr/local directory instead of the original Qt install directory. Apparently, I could not get Qtcreator to load libraries from the new /usr/local/Qt5.12 directory as it kept trying to use the /opt/Qt directory even though I'd edited the kits in Qtcreator to make the /usr/local/Qt-5.12.4 directory the default.
            I ended up just copying the freshly-built libqsqlmysql.so file from the /usr/local/Qt-5.12.4/plugins/sqldrivers directory to /opt/QtLTS/5.12.4/gcc_64/plugins/sqldrivers
            and my code loaded the mysql library and ran!
            Thanks,
            Phil

            jsulmJ 1 Reply Last reply
            0
            • M montanaviking

              Hi Jsulm,
              I'll try your suggestions. However, I was able to get the mysql library to load via:

              1. Installed the Qt5.12.4 package again in another directory, i.e. /opt/QtLTS
              2. ran ./configure -sql-mysql in the /opt/QtLTS/5.12.4/Src directory (as root)
              3. make install

              The above took several hours.
              New code was then installed in my /usr/local directory instead of the original Qt install directory. Apparently, I could not get Qtcreator to load libraries from the new /usr/local/Qt5.12 directory as it kept trying to use the /opt/Qt directory even though I'd edited the kits in Qtcreator to make the /usr/local/Qt-5.12.4 directory the default.
              I ended up just copying the freshly-built libqsqlmysql.so file from the /usr/local/Qt-5.12.4/plugins/sqldrivers directory to /opt/QtLTS/5.12.4/gcc_64/plugins/sqldrivers
              and my code loaded the mysql library and ran!
              Thanks,
              Phil

              jsulmJ Online
              jsulmJ Online
              jsulm
              Lifetime Qt Champion
              wrote on last edited by
              #6

              @montanaviking You can specify installation directory when calling configure.
              In QtCreator you need to add your new Qt installation under Options/Kit and then Qt versions (you simply select qmake from your new Qt).

              https://forum.qt.io/topic/113070/qt-code-of-conduct

              1 Reply Last reply
              1
              • M Offline
                M Offline
                montanaviking
                wrote on last edited by
                #7

                Hi Jsulm,
                I'm sure I'm doing something wrong, but oddly, pointing Qtcreator kit at the directory of the newly-built Qt 5.12.4 installation (/usr/local/Qt-5.12.4) didn't work and QtCreator still kept trying to compile against the precompiled ( /opt/QtLTS/5.12.4) Qt directory and its libraries. I had to add the newly-built libqsqlmysql.so to the /opt/QtLTS/5.12.4/gcc_64/plugins/sqldrivers to properly compile my project. Checking the compiler output showed that in spite of making the /usr/local/Qt-5.12.4 the default kit, Qtcreator kept using the /opt/QtLTS/5.12.4/ installation and therefore could not find the mysql library until I added it.

                I will try to set my installation directory (instead of the default) next time I compile Qt - Thanks,

                By (I know this is a separate questions) the way, when I tried compiling Qt 5.12.4 to produce static libraries, by using the -static option with ./configure, i.e. ./configure -static, this command gave an error that -static is not a valid option. Did the Qt company somehow disallow static compiling? This is strange to me because all the documentation had me believe that ./configure -static is a valid command?

                Thanks again for your advice!
                Phil

                jsulmJ 1 Reply Last reply
                0
                • M montanaviking

                  Hi Jsulm,
                  I'm sure I'm doing something wrong, but oddly, pointing Qtcreator kit at the directory of the newly-built Qt 5.12.4 installation (/usr/local/Qt-5.12.4) didn't work and QtCreator still kept trying to compile against the precompiled ( /opt/QtLTS/5.12.4) Qt directory and its libraries. I had to add the newly-built libqsqlmysql.so to the /opt/QtLTS/5.12.4/gcc_64/plugins/sqldrivers to properly compile my project. Checking the compiler output showed that in spite of making the /usr/local/Qt-5.12.4 the default kit, Qtcreator kept using the /opt/QtLTS/5.12.4/ installation and therefore could not find the mysql library until I added it.

                  I will try to set my installation directory (instead of the default) next time I compile Qt - Thanks,

                  By (I know this is a separate questions) the way, when I tried compiling Qt 5.12.4 to produce static libraries, by using the -static option with ./configure, i.e. ./configure -static, this command gave an error that -static is not a valid option. Did the Qt company somehow disallow static compiling? This is strange to me because all the documentation had me believe that ./configure -static is a valid command?

                  Thanks again for your advice!
                  Phil

                  jsulmJ Online
                  jsulmJ Online
                  jsulm
                  Lifetime Qt Champion
                  wrote on last edited by
                  #8

                  @montanaviking I actually wasn't talking about QtCreator but about providing installation directory to the configure script, so make install puts the libs into that directory.
                  To add another Qt installation in QtCreator you need to add it in Options - select its qmake there. Then create a Kit there you select this Qt version.

                  -static is still a valid parameter for configure.
                  Which configure exactly did you call? The top one?

                  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