Important: Please read the Qt Code of Conduct -

Cross compiling QMYSQL driver for RPi3

  • Hello,

    I have set up cross compilation for the raspberry pi, and it works perfectly.
    Except since I added SQL queries in my project, I use QtSql module, and I rebuilt the driver with the RPi sysroot, like you should do.

    But I use MySQL and it seems that every single sql driver is available except for QMYSQL...

    QSqlDatabase: QMYSQL driver not loaded
    QSqlDatabase: available drivers: QSQLITE QSQLITE2 QODBC QODBC3 QPSQL QPSQL7 QTDS QTDS7
    QSqlQuery::exec: database not open

    See this list, not even the one I want.

    I searched, but my machine (ubuntu 16.04) can run my app perfectly with the plugin QMYSQL. But when I rebuilt it using the qmake of my sysroot, it creates a makefile that doesn't contain instructions to build QMYSQL, which is weird because the file does contain them.



    Thanks in advance !

  • Lifetime Qt Champion


    Since you marked you thread as solved, did you successfully built the plugin ?

  • Yes, it was pretty hard, I had to manually edit several files to add mysql in the make list, and also during building an include failed "mysql.h", I had to edit this include to the absolute path of mysql.h and it worked

  • Lifetime Qt Champion

    What sysroot are you using to cross-compile Qt ? Did you forget to put the relevant MySQL files in it ?

  • I'm attempting the exact same thing at the moment as per this system thread.

    Any chance you could elaborate on how you solved the issue?

Log in to reply