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. build Qt5.12.4 for Ubuntu 18.04 MYSQL driver
Forum Updated to NodeBB v4.3 + New Features

build Qt5.12.4 for Ubuntu 18.04 MYSQL driver

Scheduled Pinned Locked Moved Solved General and Desktop
6 Posts 3 Posters 1.3k Views 2 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.
  • M Offline
    M Offline
    montanaviking
    wrote on last edited by
    #1

    Hi
    Could someone kindly tell me the proper method to build Qt5.12 with the mysql driver?
    I attempted:
    #/opt/Qt/5.12.4/Src# ./configure -sql-mysql
    producing the result:
    ERROR: The OpenGL functionality tests failed!
    You might need to modify the include and library search paths by editing QMAKE_INCDIR_OPENGL[_ES2],
    QMAKE_LIBDIR_OPENGL[_ES2] and QMAKE_LIBS_OPENGL[_ES2] in the mkspec for your platform.

    ERROR: Feature 'sql-mysql' was enabled, but the pre-condition 'libs.mysql' failed.

    Check config.log for details.


    my config.log file showed for mysql:
    /opt/Qt/5.12.4/Src# cat config.log | grep mysql
    Command line: -sql-mysql
    loaded result for library config.qtbase_sqldrivers.libraries.mysql
    Trying source 0 (type mysqlConfig) of library mysql ...
    mysql_config not found.
    Trying source 1 (type mysqlConfig) of library mysql ...
    mysql_config not found.
    Trying source 2 (type mysqlConfig) of library mysql ...
    mysql_config not found.
    Trying source 3 (type mysqlConfig) of library mysql ...
    mysql_config not found.
    Trying source 4 (type inline) of library mysql ...
    None of [libmysqlclient_r.so libmysqlclient_r.a] found in [] and global paths.
    Trying source 5 (type inline) of library mysql ...
    Trying source 6 (type inline) of library mysql ...
    None of [libmysqlclient.so libmysqlclient.a] found in [] and global paths.
    test config.qtbase_sqldrivers.libraries.mysql FAILED


    Apparently, the Qt configuration file is not able to find the libmysqlclient.so library files.
    However these exist on my Ubuntu 18.04 system as:
    /usr/lib/x86_64-linux-gnu$ ls | grep libmysqlclient
    libmysqlclient.a
    libmysqlclient_r.so
    libmysqlclient.so
    libmysqlclient.so.20
    libmysqlclient.so.20.3.19


    but apparently the Qt config file:
    /opt/Qt/5.12.4/Src/configuration file is not able to find the above files.
    Could someone kindly tell me how to proceed?
    Thanks,
    Phil

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

      Hi,

      It's explained in the documentation.

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

        Hi SGaist,
        I had been scouring this documentation, and it's the first place I went to but it's still not clear to me and here's what happened when I do:
        root@bellatrix:/opt/Qt/5.12.4/Src/qtbase/src/plugins/sqldrivers# /opt/Qt/5.12.4/gcc_64/bin/qmake -- MYSQL_PREFIX=/usr/include/mysql
        Project ERROR: You cannot configure sqldrivers separately within a top-level build.

        root@bellatrix:/opt/Qt/5.12.4/Src/qtbase/src/plugins/sqldrivers# /opt/Qt/5.12.4/gcc_64/bin/qmake -- MYSQL_INCDIR=/usr/include/mysql -- MYSQL_LIBDIR=/usr/lib/x86_64-linux-gnu
        Project ERROR: You cannot configure sqldrivers separately within a top-level build.

        Thanks,
        Phil

        1 Reply Last reply
        0
        • B Offline
          B Offline
          Bonnie
          wrote on last edited by Bonnie
          #4

          Your Src dir is configured to build the whole Qt, so you cannot configure plugin folder separately.
          (Here's a good habit called shadow-building: Don't run configure / qmake in the source folder but in an empty build folder. This will keep the source clean.)
          If all you want is just the mysql plugin, you don't need to build Qt.
          Get a clean source, and follow the instruction from the documentation again.

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

            @montanaviking said in build Qt5.12.4 for Ubuntu 18.04 MYSQL driver:

            Project ERROR: You cannot configure sqldrivers separately within a top-level build.

            Hi SGaist, Bonnie,
            I did the following:
            cd $QTDIR/qtbase/src/plugins/sqldrivers

            touch .qmake.stash

            touch .qmake.super

            qmake -- MYSQL_PREFIX=/usr/local

            make sub-mysql

            make

            make install

            It appears that adding empty .qmake.stash and .qmake.super to the $QTDIR/qtbase/src/plugins/sqldrivers directory
            was necessary to enable the build of the mysql driver.
            It appears I can now open the mysql database from my Qt5.12.4 program without error.
            Thanks and best,
            Phil

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

              Hi, I am running Qt5.12.4 with Ubuntu 18.04 64-bit and the following is how I compiled Qt statically:
              Install Qt+source to directorysource this is the downloaded and installed source Qt5.12.4 code
              mkdir directorystaticcompile this is the directory where configure, make, and make install are run
              mkdir directorystaticinstall this is where the compiled Qt5.12.4 libraries and includes, etc.. are installed

              $ cd directorystaticcompile
              $ sudo directorysource/configure -v -static -qt-zlib -qt-pcre -qt-libpng -qt-libjpeg -qt-freetype -qt-xcb -make libs -nomake tools -nomake examples -nomake tests -opensource -confirm-license -egl -opengl es2 -skip wayland -prefix directorystaticinstall -sql-mysql -feature-freetype -fontconfig

              The above will build Qt and takes a few hours on most computers

              After the build is complete:

              $ sudo make

              The above will take a few minutes

              Then:

              $ sudo make install

              The above finishes the install
              Best,
              Phil

              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