Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/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 sqldrivers.pro file does contain them.

    0_1524652311149_e4c2a305-b48c-4bc8-9b5f-61044e5e5bda-image.png

    0_1524652365896_f92813b1-4d0e-48b7-9034-2bd6dc08bb95-image.png

    Thanks in advance !


  • Lifetime Qt Champion

    Hi,

    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