Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Problems compile the mysqldriver ...



  • Hi,
    I know that this a not a new problem and a read alot of the threads, but do not found the correct solution.

    I am using kubuntu 17.10 (fresh installation) and also installed qt 5.9.2 new.
    MySQL is also a client and dev version installed, but I still get the following to lines as alarm,
    when I opening the "mysqlpro".

    Cannot read /qtsqldrivers-config.pri: No such file or directory
    

    The file "qsqldriverbase.pri" is existing in the folder:
    /home/<user>/Qt/5.9.2/Src/qtbase/src/plugins/sqldrivers/qsqldriverbase.pri

    Project ERROR: Library 'mysql' is not defined.
    

    the following package are installed

    ii  mysql-client-5.7                 5.7.20-0ubuntu0.17.10 amd64                 MySQL database client binaries
    ii  mysql-client-core-5.7            5.7.20-0ubuntu0.17.10 amd64                 MySQL database core client binaries
    ii  mysql-common                     5.8+1.0.2ubuntu1      all                   MySQL database common files, e.g. /etc/mysql/my.cnf
    ii  mysql-server-core-5.7            5.7.20-0ubuntu0.17.10 amd64                 MySQL database server binaries
    ii  libqt5sql5:amd64                 5.9.1+dfsg-10ubuntu1  amd64                 Qt 5 SQL module
    ii  libqt5sql5-mysql:amd64           5.9.1+dfsg-10ubuntu1  amd64                 Qt 5 MySQL database driver
    ii  libqt5sql5-sqlite:amd64          5.9.1+dfsg-10ubuntu1  amd64                 Qt 5 SQLite 3 database driver
    ii  libmysqlclient-dev               5.7.20-0ubuntu0.17.10 amd64                 MySQL database development files
    ii  libmysqlclient20:amd64           5.7.20-0ubuntu0.17.10 amd64                 MySQL database client library
    

    The main reason why I will compile the mysql driver is, because of message, driver existing, but can not loaded.

    Thanks for any help
    R.


  • Lifetime Qt Champion

    Hi,

    IIRC, you now have to configure qtbase once before you can build the SQL drivers.



  • @SGaist
    Hello,
    I have run the script "/home/<user>/Qt/5.9.2/Src/configure" again.
    here is the releated part of the "config.summary"

    Qt Sql:
      DB2 (IBM) .............................. no
      InterBase .............................. no
      MySql .................................. yes
      OCI (Oracle) ........................... no
      ODBC ................................... no
      PostgreSQL ............................. no
      SQLite2 ................................ no
      SQLite ................................. yes
        Using system provided SQLite ......... no
      TDS (Sybase) ........................... no
    

    Then I execute the qmake and here is the compile related result (using open source)

    Qt Sql:
      DB2 (IBM) .............................. yes
      InterBase .............................. yes
      MySql .................................. yes
      OCI (Oracle) ........................... yes
      ODBC ................................... yes
      PostgreSQL ............................. yes
      SQLite2 ................................ yes
      SQLite ................................. yes
        Using system provided SQLite ......... no
      TDS (Sybase) ........................... yes
    

    But still, when I open the "/home/<user>/Qt/5.9.2/Src/qtbase/src/plugins/sqldrivers/mysql/mysql.pro"
    I still get the message

    Cannot read /qtsqldrivers-config.pri: No such file or directory
    Project ERROR: Library 'mysql' is not defined.
    

    When I open the complete driver project "/home/<user>/Qt/5.9.2/Src/qtbase/src/plugins/sqldrivers/sqldrivers.pro"
    I will get the following message

    Project ERROR: Could not find feature sql-psql.
    [Ungenau] Project ERROR: Could not find feature system-sqlite.
    [Ungenau] Project ERROR: Library 'db2' is not defined.
    [Ungenau] Project ERROR: Library 'odbc' is not defined.
    [Ungenau] Project ERROR: Library 'sqlite2' is not defined.
    [Ungenau] Project ERROR: Library 'oci' is not defined.
    [Ungenau] Project ERROR: Library 'mysql' is not defined.
    [Ungenau] Project ERROR: Library 'psql' is not defined.
    [Ungenau] Project ERROR: Library 'ibase' is not defined.
    [Ungenau] Project ERROR: Library 'tds' is not defined.
    

    As well, when I execute my application I will get the message.

    QSqlDatabase: QMYSQL driver not loaded
    QSqlDatabase: available drivers: QSQLITE QMYSQL QMYSQL3 QPSQL QPSQL7
    

    the driver of "/usr/lib/x86_64-linux-gnu/qt5/plugins/sqldrivers/libqsqlmysql.so"
    show the following with "ldd libqsqlmysql.so"

            linux-vdso.so.1 =>  (0x00007ffe21bfc000)
            libQt5Sql.so.5 => /usr/lib/x86_64-linux-gnu/libQt5Sql.so.5 (0x00007efef021a000)
            libQt5Core.so.5 => /usr/lib/x86_64-linux-gnu/libQt5Core.so.5 (0x00007efeefad1000)
            libmysqlclient.so.20 => /usr/lib/x86_64-linux-gnu/libmysqlclient.so.20 (0x00007efeef4c0000)
            libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007efeef13a000)
            libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007efeeed5a000)
            libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007efeeeb3b000)
            libicui18n.so.57 => /usr/lib/x86_64-linux-gnu/libicui18n.so.57 (0x00007efeee6c7000)
            libicuuc.so.57 => /usr/lib/x86_64-linux-gnu/libicuuc.so.57 (0x00007efeee322000)
            libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007efeee105000)
            libdouble-conversion.so.1 => /usr/lib/x86_64-linux-gnu/libdouble-conversion.so.1 (0x00007efeedef4000)
            libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007efeedcf0000)
            libglib-2.0.so.0 => /lib/x86_64-linux-gnu/libglib-2.0.so.0 (0x00007efeed9dc000)
            libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007efeed686000)
            libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007efeed46f000)
            /lib64/ld-linux-x86-64.so.2 (0x00007efef0676000)
            libicudata.so.57 => /usr/lib/x86_64-linux-gnu/libicudata.so.57 (0x00007efeeb9f2000)
            libpcre.so.3 => /lib/x86_64-linux-gnu/libpcre.so.3 (0x00007efeeb780000)
    

    I am using the "gcc --version"

    gcc (Ubuntu 7.2.0-8ubuntu3) 7.2.0
    Copyright (C) 2017 Free Software Foundation, Inc.
    This is free software; see the source for copying conditions.  There is NO
    warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
    

    All commands are execute not with "sudo".

    What I am doing wrong ?

    Best regards
    R.


  • Lifetime Qt Champion

    "/usr/lib/x86_64-linux-gnu/qt5/plugins/sqldrivers/libqsqlmysql.so is your distribution provided Qt MySQL plugin.

    Which qmake did you use ?
    If the plugin is built and installed properly it should go inside your 5.9.2 Qt installation.



  • @SGaist
    When I enter only "qmake"
    I will get the error

    qmake: could not exec '/usr/lib/x86_64-linux-gnu/qt4/bin/qmake': No such file or directory
    

    I have used the complete path of "/home/<user>/Qt/5.9.2/gcc_64/bin/" for the execution of "qmake".

    I would like to use this folder

    /home/<user>/Qt/5.9.2/gcc_64/bin/
    

    But there is also a folder

    /usr/lib/x86_64-linux-gnu/qt5/bin/
    

    where a qmake version is existing.

    I do not know, which version will remove by

    sudo apt-get remove qt5-qmake
    

    Within the folder "/usr/lib/x86_64-linux-gnu/qt4/bin/", there is only one file qdbus.

    Thanks for the help up to now.

    Where is defined, which version of qmake is used ?

    Best regards
    R.


  • Lifetime Qt Champion

    Don't enter only qmake, you'll be using your distribution provided Qt and in this case it's even Qt 4.

    Always use the full path to your Qt version qmake.



  • Hello,

    I have used the complete path of "/home/<user>/Qt/5.9.2/gcc_64/bin/" for the execution of "qmake".

    I already used the complete path for the execution of the qmake, but I have still these problems.
    Because of other problems with "events during a ssl connection", I would like to have a proper and correct installation.
    That was mainly the reason for the complete reinstallation of my develop-machine.

    Up to now, I can not compile the "MySQL" plugin of the qt system because of

    Cannot read /qtsqldrivers-config.pri: No such file or directory
    Project ERROR: Library 'mysql' is not defined.
    

    Any other hints ?

    Anyways, I still have to say thank you for your support.

    Edit: execute now "make" and after that "make install". Maybe this was my fault.

    Best regards
    R.


  • Lifetime Qt Champion

    The documentation for building the SQL plugins is being updated. You can try the approach described here.



  • @SGaist
    After I execute the commands

    cd /home/<User>/Qt/5.9.2/Src/
    make
    make check
    sudo make install
    

    the mysql driver is installed on my system and now my program run without a failure.
    But when I open the mysql driver project I still get the failure as list above.
    But I will continue on my project, because the MYSQL failure is gone.

    Thanks for your support SGaist!

    Best regards
    R


Log in to reply