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

Trouble building the QMYSQL Plugin on Unix (Mint 19.2)



  • Hi,
    New here so please forgive any possible infractions of the rules.
    I'm trying to build the MySQL plugin. I know that this question has been asked many times before, but nothing that I've seen so far addresses my specific issue.

    My environment is as follows:

    • Linux Mint 19.2
    • Qt version 5.12.5
    • Have installed the shared library libmysqlclient.so (using sudo apt-get install --yes libmysqlclient-dev). The consequence of this is that various header files were installed in /usr/include/mysql, and locate mysqlclient.so gives me ...
    $ locate mysqlclient.so
    /usr/lib/x86_64-linux-gnu/libmysqlclient.so
    /usr/lib/x86_64-linux-gnu/libmysqlclient.so.20
    /usr/lib/x86_64-linux-gnu/libmysqlclient.so.20.3.14
    

    I have followed the official instructions described here, and so with some variation I did the following ...

    $ export QTDIR=/home/george/Qt
    $ export QTVERSION=5.12.5
    $ cd $QTDIR/$QTVERSION/Src/qtbase/src/plugins/sqldrivers
    $ $QTDIR/$QTVERSION/gcc_64/bin/qmake -- MYSQL_PREFIX=/usr/include/mysql
    

    But the result is ...

    Running configuration tests...
    Done running configuration tests.
    
    Configure summary:
    
    Qt Sql Drivers:
      DB2 (IBM) .............................. yes
      InterBase .............................. yes
      MySql .................................. no
      OCI (Oracle) ........................... yes
      ODBC ................................... no
      PostgreSQL ............................. no
      SQLite2 ................................ yes
      SQLite ................................. yes
        Using system provided SQLite ......... no
      TDS (Sybase) ........................... no
    
    Qt is now configured for building. Just run 'make'.
    Once everything is built, you must run 'make install'.
    Qt will be installed into '/home/george/Qt/5.12.5/gcc_64'.
    
    Prior to reconfiguration, make sure you remove any leftovers from
    the previous build.
    

    BTW executing ...

    $ $QTDIR/$QTVERSION/gcc_64/bin/qmake "INCLUDEPATH+=/usr/include/mysql" "LIBS+=-L/usr/lib/x86_64-linux-gnu -lmysqlclient"
    

    ... gave me the same result - i.e.NO MySql. The Instructions then require you to execute ...

    make sub-mysql
    

    I have no clue what 'sub-' is intended to mean, so I tried the following alternatives without success ...

    $ make mysql
    make: Nothing to be done for 'mysql'.
    
    $ make
    cd oci/ && ( test -e Makefile || /home/george/Qt/5.12.5/gcc_64/bin/qmake -o Makefile /home/george/Qt/5.12.5/Src/qtbase/src/plugins/sqldrivers/oci/oci.pro ) && make -f Makefile 
    make[1]: Entering directory '/home/george/Qt/5.12.5/Src/qtbase/src/plugins/sqldrivers/oci'
    g++ -c -pipe -O2 -g -std=c++1y -fvisibility=hidden -fvisibility-inlines-hidden -fno-exceptions -Wall -W -Wvla -Wdate-time -D_REENTRANT -fPIC -DQT_DEPRECATED_WARNINGS -DQT_NO_NARROWING_CONVERSIONS_IN_CONNECT -DQT_NO_CAST_TO_ASCII -DQT_NO_CAST_FROM_ASCII -DQT_NO_EXCEPTIONS -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -DQT_NO_DEBUG -DQT_PLUGIN -DQT_SQL_LIB -DQT_CORE_LIB -I. -I/home/george/Qt/5.12.5/gcc_64/include/QtSql/5.12.5 -I/home/george/Qt/5.12.5/gcc_64/include/QtSql/5.12.5/QtSql -I/home/george/Qt/5.12.5/gcc_64/include/QtCore/5.12.5 -I/home/george/Qt/5.12.5/gcc_64/include/QtCore/5.12.5/QtCore -I/home/george/Qt/5.12.5/gcc_64/include -I/home/george/Qt/5.12.5/gcc_64/include/QtSql -I/home/george/Qt/5.12.5/gcc_64/include/QtCore -I.moc -I/home/qt/openssl-1.1.1b/include -I/home/george/Qt/5.12.5/gcc_64/mkspecs/linux-g++ -o .obj/qsql_oci.o qsql_oci.cpp
    qsql_oci.cpp:66:10: fatal error: oci.h: No such file or directory
     #include <oci.h>
              ^~~~~~~
    compilation terminated.
    Makefile:827: recipe for target '.obj/qsql_oci.o' failed
    make[1]: *** [.obj/qsql_oci.o] Error 1
    make[1]: Leaving directory '/home/george/Qt/5.12.5/Src/qtbase/src/plugins/sqldrivers/oci'
    Makefile:50: recipe for target 'sub-oci-make_first' failed
    make: *** [sub-oci-make_first] Error 2
    

    Any suggestions would be most welcome - thanks.


  • Lifetime Qt Champion

    Hi and welcome to devnet,

    Check the test logs to see what error happened exactly.



  • @Bardfast said in Trouble building the QMYSQL Plugin on Unix (Mint 19.2):

    $QTDIR/$QTVERSION/gcc_64/bin/qmake -- MYSQL_PREFIX=/usr/include/mysql

    Thank you for your reply.

    Unfortunately the log doesn't tell me much. The log <./Src/qtbase/src/plugins/sqldrivers/config.log> reads as follows ...

    Command line: MYSQL_PREFIX=/usr/include/mysql
    Global lib dirs: [/home/qt/openssl-1.1.1b/lib] [/usr/lib/gcc/x86_64-linux-gnu/7 /usr/lib/x86_64-linux-gnu /usr/lib /lib/x86_64-linux-gnu /lib]
    Global inc dirs: [/home/qt/openssl-1.1.1b/include] [/usr/include/c++/7 /usr/include/x86_64-linux-gnu/c++/7 /usr/include/c++/7/backward /usr/lib/gcc/x86_64-linux-gnu/7/include /usr/local/include /usr/lib/gcc/x86_64-linux-gnu/7/include-fixed /usr/include/x86_64-linux-gnu /usr/include]
    loaded result for library config.sqldrivers.libraries.db2
    test config.sqldrivers.libraries.db2 succeeded
    loaded result for library config.sqldrivers.libraries.ibase
    test config.sqldrivers.libraries.ibase succeeded
    loaded result for library config.sqldrivers.libraries.mysql
    test config.sqldrivers.libraries.mysql FAILED
    loaded result for library config.sqldrivers.libraries.oci
    test config.sqldrivers.libraries.oci succeeded
    loaded result for library config.sqldrivers.libraries.odbc
    test config.sqldrivers.libraries.odbc FAILED
    loaded result for library config.sqldrivers.libraries.psql
    test config.sqldrivers.libraries.psql FAILED
    loaded result for library config.sqldrivers.libraries.sqlite2
    test config.sqldrivers.libraries.sqlite2 succeeded
    loaded result for library config.sqldrivers.libraries.tds
    test config.sqldrivers.libraries.tds FAILED
    
    

    Is this the 'test' log that you were referring to?


Log in to reply