Qt configure could not find MySQL installation when cross compiling for raspi3?



  • Hi everyone.
    Right to the point, here is my configure command I used:

    ../configure -release -opengl es2 -no-eglfs -qt-xcb -xcb -sql-mysql -no-use-gold-linker -opensource -confirm-license -nomake examples -nomake tests -make libs -device linux-rasp-pi3-g++ -device-option CROSS_COMPILE=$RPI_TOOLCHAIN -sysroot $RPI_SYSROOT -prefix /usr/local/qt5pi -hostprefix ~/toolchain/qt5 -extprefix ~/toolchain/qt5pi -recheck-all
    

    And here is the mysql confirmation on pi(i haved synced the sysroot to my host machine):

    pi@raspberrypi:~ $ mysql_config --version
    10.1.38
    pi@raspberrypi:~ $ mysql_config --libs
    -L/usr/lib/arm-linux-gnueabihf  -lmariadbclient -lpthread -lz -lm -ldl
    pi@raspberrypi:~ $ mysql_config --include
    -I/usr/include/mysql
    

    But the configure command throw nasty error:

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

    config.log for more details:

    [...]
    looking for library mysql
    Trying source 0 (type mysqlConfig) of library mysql ...
    mysql_config not found.
      => source produced no result.
    Trying source 1 (type mysqlConfig) of library mysql ...
    mysql_config not found.
      => source produced no result.
    Trying source 2 (type mysqlConfig) of library mysql ...
    mysql_config not found.
      => source produced no result.
    Trying source 3 (type mysqlConfig) of library mysql ...
    mysql_config not found.
      => source produced no result.
    Trying source 4 (type inline) of library mysql ...
    mysql.h not found in [] and global paths.
      => source produced no result.
    Trying source 5 (type inline) of library mysql ...
      => source failed condition 'config.win32'.
    Trying source 6 (type inline) of library mysql ...
    mysql.h not found in [] and global paths.
      => source produced no result.
    test config.qtbase_sqldrivers.libraries.mysql FAILED
    [...]
    

    It seems that configure looks for mysql_config in host machine! what should we do?



  • You should change '-plugin-sql-mysql' parameter. Remove that and add '-qt-sql-mysql'

    As you can see https://doc.qt.io/archives/qt-4.8/configure-options.html for details.



  • Hi @dewy

    That's for Qt4, for new versions (5.12.3 for mine) as the ./configure --help says:

    [...]
    Database options:
    
      -sql-<driver> ........ Enable SQL <driver> plugin. Supported drivers:
                             db2 ibase mysql oci odbc psql sqlite2 sqlite tds
                             [all auto]
      -sqlite .............. Select used sqlite3 [system/qt]
    [...]
    

    We should use -sql-mysql to enable plugin.



  • Hello again,
    That's mean, you cannot use plugin type for configure. when I used plugin types, have bugs. So I use that.
    For 5.x.x versions, '-sql-mysql'



  • This post is deleted!


  • Seems to be a bug reported here QTBUG-50244

    Nobody tried to integrate MySQL for a Raspberry Pi project already ?! no workaround?!
    Seems strange :(