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

QMYSQL driver not loaded - cross compiling for Raspberry PI 3



  • Dear All,

    I'm cross compiling my project for Raspberry PI 3 and it successful except that I cannot connect to MySql database. I got this standard error:
    QSqlDatabase: QMYSQL driver not loaded
    QSqlDatabase: available drivers: QSQLITE QSQLITE2 QODBC QODBC3 QPSQL QPSQL7 QTDS QTDS7

    Of course there are different threads that explain this but unfortunately this doesn't help...
    My host: Ubuntu 18.04
    Qt version that I use to cross compile for RPi3: 5.12.3
    Target: Raspberry PI 3

    Some time ago I was able to create the project (also on Ubuntu 18.04) and after some struggles I was able to connect to MySql. Unfortunately now I don't remember every single step I did... The project that I successfully run on the host, now I would like to run on RPi. I'm able to run the program on RPi but when I try to connect to the database I get the above error.

    I understand I need to have libqsqlmysql.so library. Unfortunately I don't have it:
    0d07f690-22d1-4cbb-b978-7a0ec280b4a4-image.png

    I downloaded sources for Qt5.12.3 from here. I understand I need to compile them so that I have the missing library. Am I right? Unfortunately I'm not able to do it.
    Here are some outputs that I get:
    313aaa2d-8495-49d2-919b-3ee9f85c37ec-image.png
    db52b366-f829-4e92-930f-683b7163f531-image.png

    8a126e26-9e17-44c6-ad38-4507a7f81264-image.png

    Could you also explain me what is actually the difference in removing the problem for regular compilation and cross compilation? Shouldn't I prepare the mysql driver on the target rather than on the host?

    I would be very happy to receive any suggestion...



  • @JarekT said in QMYSQL driver not loaded - cross compiling for Raspberry PI 3:

    I would be very happy to receive any suggestion...

    First, I would suggest you to read documentation ==> https://doc.qt.io/qt-5/sql-driver.html#how-to-build-the-qmysql-plugin-on-unix-and-macos

    Then, check MySQL or MariaDB shared libs and headers are installed on your platform.
    Rerun qmake



  • @KroMignon Thank you for your reply. Please tell me should I do it on target or on the host?

    The idea is to connect to the mysql installed on the target, so I think it should be done on the target. My MySQL database location is /var/lib, so I tried this:

    c61f7c61-7868-4f54-b05e-50d5843508cc-image.png

    but it looks like there is no qmake command available. I tried to find for any qmake file in the target:
    75fa9bd3-4fc7-43ea-b904-79ca70901f90-image.png



  • @JarekT said in QMYSQL driver not loaded - cross compiling for Raspberry PI 3:

    Please tell me should I do it on target or on the host?

    On the target of course.
    Did you cross-compile Qt for you RPI or did you use a precompiled version?



  • @KroMignon I did cross-compile according to this procedure: LINK



  • This post is deleted!


  • @JarekT So you have to add mysql libs on your RPI before creating the sysroot

    on RPI

    sudo apt-get install libmysqlclient-dev libmysqld-dev
    

    After that you should be able to cross-compile the plugin



  • @KroMignon When I tried to install those packages I got information that mariadb counterparts are available. So I tried to install them and it appeared that libmariadb-dev-compat,libmariadb-dev I already had, but libmariadbd-dev I didn't have so I installed it.

    How can I cross-compile the plugin?



  • @JarekT said in QMYSQL driver not loaded - cross compiling for Raspberry PI 3:

    How can I cross-compile the plugin?

    After installing the missed packages, you have to recreate/update the sysroot.
    Then restart qmake in the sqldrivers directory (I suppose RPI sysroot is located at /home/embsys/raspi/sysroot):

    /home/embsys/raspi/qtbase/bin/qmake -- MYSQL_PREFIX=/home/embsys/raspi/sysroot/usr/local
    
    make
    make install
    

  • Qt Champions 2019

    @KroMignon said in QMYSQL driver not loaded - cross compiling for Raspberry PI 3:

    Then restart qmake in the sqldrivers directory

    I would suggest to do out of source builds to avoid problems with build artefacts from previous builds.



  • @KroMignon said in QMYSQL driver not loaded - cross compiling for Raspberry PI 3:

    you have to recreate/update the sysroot

    In the ~/raspi folder I did this (192.168.0.100 is IP of RPi):
    rsync -avz pi@192.168.0.100:/lib sysroot
    rsync -avz pi@192.168.0.100:/usr/include sysroot/usr
    rsync -avz pi@192.168.0.100:/usr/lib sysroot/usr
    rsync -avz pi@192.168.0.100:/opt/vc sysroot/opt

    Is this what you meant by "you have to recreate/update the sysroot"?

    After that I did qmake and I got the following results:
    75f17afe-7dfe-451b-b5d2-097bd0b6605b-image.png

    Unfortunately I don't see that MySql was configured...

    Is the prefix "MYSQL_PREFIX=/home/embsys/raspi/sysroot/usr/local" correct and is it enough?

    @jsulm Before I did qmake I deleted whole src folder and extracted it again. Only then I did qmake. Is this what you meant?



  • @JarekT said in QMYSQL driver not loaded - cross compiling for Raspberry PI 3:

    Is the prefix "MYSQL_PREFIX=/home/embsys/raspi/sysroot/usr/local" correct and is it enough?

    I don't really know, I don't have a RPI to test it.
    But according to this post ==> https://raspberrypi.stackexchange.com/a/101366
    You should probably use this:

    /home/embsys/raspi/qtbase/bin/qmake -- MYSQL_PREFIX=/home/embsys/raspi/sysroot/usr/lib/arm-linux-gnueabihf
    


  • @KroMignon I've changed the prefix but looks like it didn't help..

    1ac29b64-8a32-4f97-852a-3f6a26e692cc-image.png

    What can I do "remove any leftovers from the previous build" before I do reconfiguration?


  • Qt Champions 2019

    @JarekT said in QMYSQL driver not loaded - cross compiling for Raspberry PI 3:

    What can I do "remove any leftovers from the previous build" before I do reconfiguration?

    Extract again the source code. To avoid this do out of source builds:

    mkdir build
    cd build
    qmake PATH_TO_SOURCE
    


  • @jsulm I've extracted again the sources. But I'm not sure if I understand what you meant by: "To avoid this do out of source builds". Do you mean that after I have newly extracted source code, I should always do the qmake in a new folder (eg. "build" as you mentioned) so that I do not affect the source code and in this way I can always do fresh compilation without the need to extract the source code files again?

    Assuming that this is what you meant I did this:
    0c2b3ccd-161b-48af-ba8f-3ab87a8755bc-image.png

    As I can see mysql was not compiled... Could you please check if the paths and prefixes are correct?...


  • Qt Champions 2019

    @JarekT said in QMYSQL driver not loaded - cross compiling for Raspberry PI 3:

    I should always do the qmake in a new folder

    Yes.

    To check why it still does not work please see what is in configure.log file.



  • @jsulm Here is what I have in the config.log (I'm showing here only the part that contains information about the failures)

    b3572182-0f72-48a3-87cb-5f6a8ed4bafb-image.png

    Could you please help me understand those problems?



  • @JarekT said in QMYSQL driver not loaded - cross compiling for Raspberry PI 3:

    Could you please help me understand those problems?

    Can you says which is the local path where you have put the sysroot? I supposed it was /home/embsys/raspi/sysroot.
    Then search in this path where is located libmysqlclient with find:

    find /home/embsys/raspi/sysroot -name libmysqlclient*.*
    

    Then use the path to configure/compile your plugin:

    /home/embsys/raspi/qtbase/bin/qmake -- MYSQL_PREFIX=<lib_mysqlclient_path>
    


  • @KroMignon said in QMYSQL driver not loaded - cross compiling for Raspberry PI 3:

    Can you says which is the local path where you have put the sysroot? I supposed it was /home/embsys/raspi/sysroot.

    Yes, this is my sysroot. I did it as you can see below
    2027e562-be0c-446d-9197-b0c4ae8404a8-image.png

    This command I tried also before and the results are unsuccessful as before..
    Here I'm configuring/compiling the plugin using sqldriver.pro file, but I also read somewhere that mysql.pro (/home/embsys/raspi/qt-everywhere-src-5.12.3/qtbase/src/plugins/sqldrivers/mysql/mysql.pro) file should compiled. Do you know anything about it?



  • Another idea: shouldn't I configure qmake itself before I try to use it to compile the plugin?

    That was my configure command when I was doing cross-compiling configuration (as in the LINK)

    ./configure -release -opengl es2 -device linux-rasp-pi3-g++ -device-option CROSS_COMPILE=~/raspi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/arm-linux-gnueabihf- -sysroot ~/raspi/sysroot -opensource -confirm-license -make libs -prefix /usr/local/qt5pi -extprefix ~/raspi/qt5pi -hostprefix ~/raspi/qt5 -no-use-gold-linker -v -no-gbm

    The above doesn't include mysql feature (should it??)


  • Qt Champions 2019

    @JarekT said in QMYSQL driver not loaded - cross compiling for Raspberry PI 3:

    shouldn't I configure qmake itself

    What do you want to configure?



  • @jsulm Sorry if the way I explained it was not correct. I meant that when I was preparing the framework for cross-compilation in the folder /home/embsys/raspi/qtbase I did

    ./configure -release -opengl es2 -device linux-rasp-pi3-g++ -device-option CROSS_COMPILE=~/raspi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/arm-linux-gnueabihf- -sysroot ~/raspi/sysroot -opensource -confirm-license -make libs -prefix /usr/local/qt5pi -extprefix ~/raspi/qt5pi -hostprefix ~/raspi/qt5 -no-use-gold-linker -v -no-gbm

    Should it contain something about mysql?


  • Qt Champions 2019

    @JarekT said in QMYSQL driver not loaded - cross compiling for Raspberry PI 3:

    Should it contain something about mysql?

    It should be possible to build MySQL related stuff after compiling Qt.

    Did you search for libmysqlclient* as @KroMignon suggested to make sure you pass correct paths?

    Also, please post text instead of screen-shots.



  • @jsulm said in QMYSQL driver not loaded - cross compiling for Raspberry PI 3:

    Did you search for libmysqlclient* as @KroMignon suggested to make sure you pass correct paths?

    Yes, the paths for libmysqlclient.. is correct.

    embsys@JT-UBUNTU:~/qmakeBuild$ find /home/embsys/raspi/sysroot -name libmysqlclient*.*
    /home/embsys/raspi/sysroot/usr/lib/arm-linux-gnueabihf/libmysqlclient.a
    /home/embsys/raspi/sysroot/usr/lib/arm-linux-gnueabihf/libmysqlclient_r.so
    /home/embsys/raspi/sysroot/usr/lib/arm-linux-gnueabihf/libmysqlclient.so
    /home/embsys/raspi/sysroot/usr/lib/arm-linux-gnueabihf/libmysqlclient_r.a
    

    Ok, I will try to post text instead of screen-shots.



  • I'm constantly trying to solve the issue... any help would be much appreciated..

    I have noticed that when I choose different qmake, MySQL plugin is configured and prepared for building. Please have a look:

    embsys@JT-UBUNTU:~/raspi/test$ /home/embsys/Qt5.14.2/5.14.2/gcc_64/bin/qmake /home/embsys/raspi/qt-everywhere-src-5.12.3/qtbase/src/plugins/sqldrivers/sqldrivers.pro -- MYSQL_PREFIX=/home/embsys/raspi/sysroot/usr/lib/arm-linux-gnueabihf
    
    Running configuration tests...
    Checking for DB2 (IBM)... no
    Checking for InterBase... no
    Checking for MySQL... yes
    Checking for OCI (Oracle)... no
    Checking for ODBC... no
    Checking for PostgreSQL... yes
    Checking for SQLite (version 2)... no
    Checking for TDS (Sybase)... no
    Done running configuration tests.
    
    Configure summary:
    
    Qt Sql Drivers:
      DB2 (IBM) .............................. no
      InterBase .............................. no
      MySql .................................. yes
      OCI (Oracle) ........................... no
      ODBC ................................... no
      PostgreSQL ............................. yes
      SQLite2 ................................ no
      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/embsys/Qt5.14.2/5.14.2/gcc_64'.
    
    Prior to reconfiguration, make sure you remove any leftovers from
    the previous build.
    

    Unfortunately when I try to use the qmake for cross-compiler path I get the following:

    embsys@JT-UBUNTU:~/raspi/test$ /home/embsys/raspi/qtbase/qmake/qmake /home/embsys/raspi/qt-everywhere-src-5.12.3/qtbase/src/plugins/sqldrivers/sqldrivers.pro -- MYSQL_PREFIX=/home/embsys/raspi/sysroot/usr/lib/arm-linux-gnueabihf
    
    Running configuration tests...
    Checking for DB2 (IBM)... no
    Checking for InterBase... no
    Checking for MySQL... no
    Checking for OCI (Oracle)... no
    Checking for ODBC... yes
    Checking for PostgreSQL... yes
    Checking for SQLite (version 2)... yes
    Checking for TDS (Sybase)... yes
    Done running configuration tests.
    
    Configure summary:
    
    Qt Sql Drivers:
      DB2 (IBM) .............................. no
      InterBase .............................. no
      MySql .................................. no
      OCI (Oracle) ........................... no
      ODBC ................................... yes
      PostgreSQL ............................. yes
      SQLite2 ................................ yes
      SQLite ................................. yes
        Using system provided SQLite ......... no
      TDS (Sybase) ........................... yes
    
    Qt is now configured for building. Just run 'make'.
    Once everything is built, you must run 'make install'.
    Qt will be installed into '/home/embsys/raspi/qt5pi'.
    
    Prior to reconfiguration, make sure you remove any leftovers from
    the previous build.
    

    I lack good knowledge about qmake tool, but maybe there is something wrong with the qmake I try to use for Raspberry PI.
    BTW I have different qmakes in my host:

    embsys@JT-UBUNTU:~/raspi$ sudo find / -name qmake -type f
    /home/embsys/ti-processor-sdk-linux-rt-am335x-evm-05.03.00.07/linux-devkit/sysroots/x86_64-arago-linux/usr/bin/qt5/qmake
    /home/embsys/ti-processor-sdk-linux-rt-am335x-evm-05.02.00.10/linux-devkit/sysroots/x86_64-arago-linux/usr/bin/qt5/qmake
    /home/embsys/ti-processor-sdk-linux-am335x-evm-05.02.00.10/linux-devkit/sysroots/x86_64-arago-linux/usr/bin/qt5/qmake
    /home/embsys/Qt5.14.2/qt-everywhere-src-5.14.2/qtbase/bin/qmake
    /home/embsys/Qt5.14.2/5.14.2/gcc_64/bin/qmake
    /home/embsys/raspi/qt5/bin/qmake
    /home/embsys/raspi/qtbase/bin/qmake
    /home/embsys/raspi/qtbase/qmake/qmake
    find: ‘/run/user/1000/doc’: Permission denied
    find: ‘/run/user/1000/gvfs’: Permission denied
    /usr/lib/x86_64-linux-gnu/qt4/bin/qmake
    /usr/lib/qt5/bin/qmake
    

    Could sb explain what is the difference between those qmakes that are in RPi paths? namely:

    /home/embsys/raspi/qt5/bin/qmake
    /home/embsys/raspi/qtbase/bin/qmake
    /home/embsys/raspi/qtbase/qmake/qmake
    

    I tried all of them but they give the same results.

    Is it possible that I somehow have a problem with Qt instalation for cross-compiling (and consequently with qmake) and this is the problem?



  • Finally (!...) I was able to fix the problems. I'm showing the whole procedure, not only what relates to the main subject of this thread so that to contribute to the community..

    I was using the following sites as a source information to work out the following solution: LINK1 (for other Qt/Raspberry PI configuration check: link), LINK2, LINK3, LINK4, LINK5, LINK6.

    My hardware/software:

    Host:
    Ubuntu 18.04 (also I’ve check it on Ubuntu 20.04 and it also works)
    Qt ver. 5.12.3 (I also tried 5.12.9, but it didn’t work, probably there was something wrong with the fix that needs to be done on the sources) - you can install the “sources” and all the modules you need from Qt Online Installer (link) because later on you can add/remove modules/versions easily by lauching ~/Qt/MaintenanceTool
    QtCreator will be installed automatically (the newest version) when you use Qt Online Installer

    Target:
    Raspberry PI 3, with Raspbian Stretch

    Procedure:

    1. [on RPi] Edit sources list in /etc/apt/sources.list and uncomment the deb-src line:
    sudo nano /etc/apt/sources.list
    
    1. [on RPi] Update your system and install required libraries:
    sudo apt-get update
    sudo apt-get build-dep qt4-x11
    sudo apt-get build-dep libqt5gui5
    sudo apt-get install libudev-dev libinput-dev libts-dev libxcb-xinerama0-dev libxcb-xinerama0
    

    After installing MySQL itself on RPi install also MySQL libraries/packages to be used by Qt:

    sudo apt install mariadb-client libmariadb-dev-compat libqt5sql5-mysql
    
    1. [on RPi] Prepare our target directory
    sudo mkdir /usr/local/qt5pi
    sudo chown pi:pi /usr/local/qt5pi
    
    1. [on RPi] Correct links to EGL and GLES Drivers
    sudo rm /usr/lib/arm-linux-gnueabihf/libEGL.so.1.0.0
    sudo rm /usr/lib/arm-linux-gnueabihf/libGLESv2.so.2.0.0
    sudo ln -s /opt/vc/lib/libbrcmEGL.so /usr/lib/arm-linux-gnueabihf/libEGL.so.1.0.0
    sudo ln -s /opt/vc/lib/libbrcmGLESv2.so /usr/lib/arm-linux-gnueabihf/libGLESv2.so.2.0.0
    
    1. [on host] Create our working directory and get a toolchain:
    mkdir ~/raspi
    cd ~/raspi
    git clone https://github.com/raspberrypi/tools
    
    1. [on host] Create a sysroot.
    mkdir sysroot sysroot/usr sysroot/opt
    rsync -avz pi@yourpi:/lib sysroot
    rsync -avz pi@yourpi:/usr/include sysroot/usr
    rsync -avz pi@yourpi:/usr/lib sysroot/usr
    rsync -avz pi@yourpi:/opt/vc sysroot/opt
    
    1. [on host] Adjust symlinks to be relative:
    wget https://raw.githubusercontent.com/riscv/riscv-poky/master/scripts/sysroot-relativelinks.py
    chmod +x sysroot-relativelinks.py
    ./sysroot-relativelinks.py sysroot
    
    1. [on host] Modify the qmake.conf –> mkspecs/devices/linux-rasp-pi3-g++/qmake.conf
    nano ~/raspi/qtbase/mkspecs/devices/linux-rasp-pi3-g++/qmake.conf
    

    VC_LIBRARY_PATH = $$[QT_SYSROOT]/opt/vc/lib
    VC_INCLUDE_PATH = $$[QT_SYSROOT]/opt/vc/include

    VC_LINK_LINE = -L$${VC_LIBRARY_PATH}

    QMAKE_LIBDIR_OPENGL_ES2 = $${VC_LIBRARY_PATH}
    QMAKE_LIBDIR_EGL = $$QMAKE_LIBDIR_OPENGL_ES2
    QMAKE_LIBDIR_OPENVG = $$QMAKE_LIBDIR_OPENGL_ES2

    1. [on host] Protect your “sources” by creating working folder:
    cd ~/Qt/5.12.3
    tar jcvf qt-5.12.3-src.tar.bz2 Src
    cd ~/raspi
    tar xvf ~/Qt/5.12.3/qt-5.12.3-src.tar.bz2
    mv Src qt-5.12.3-src
    

    You can remove from qt-5.12.3-src the modules that you don’t want (at least for now) leaving qtbase folder - this will shorten the building process.
    Create also working folder for the building (if building would be unsuccessful all you need to do is to delete the content of this folder and start again):

    mkdir ~/raspi/build_raspi
    cd ~/raspi/build_raspi
    
    1. [on host] Configure
      From ~/raspi/build_raspi
    ../qt-5.12.3-src/configure -release -opengl es2 -device linux-rasp-pi3-g++ -device-option CROSS_COMPILE=~/raspi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/arm-linux-gnueabihf- -sysroot ~/raspi/sysroot -opensource -confirm-license -make libs -prefix /usr/local/qt5pi -extprefix ~/raspi/qt5pi -hostprefix ~/raspi/qt5 -no-use-gold-linker -v -no-gbm -sql-mysql MYSQL_INCDIR=~/raspi/sysroot/usr/include/mysql MYSQL_LIBDIR=~/raspi/sysroot/usr/lib/arm-linux-gnueabihf
    

    Notice the above contains also building MySQL driver.

    Notice that the Config summary should contain (if it doesn't, you need to correct something... and do the configure again):
    EGLFS Raspberry Pi ................... yes
    MySql .................................. yes

    Regarding “-release” parameter read here (in other words you don’t need “-debug-and-release” and the warnings you can ignore… at least this is what I can read at the forum).

    1. [on host] Make
      From ~/raspi/build_raspi
    make
    

    You can use make -j 8 instead (much faster), but if there will be problems the all the “jobs” would need to finish and consequently it could be more difficult to find the error messages.

    1. [on host] Make install
      From ~/raspi/build_raspi:
    make install
    
    1. [on host] Deploy Qt to the device. We simply sync everything from ~/raspi/qt5pi to the prefix we configured above
      From ~/raspi:
    rsync -avz qt5pi pi@192.168.1.100:/usr/local
    
    1. [on host] Configuration of QtCreator:
    • Tools > Options > Devices > Add > Generic Linux Device > Start Wizard
    • Write: “Raspberry” (your custom name), “192.168.X.X” (your Raspberry PI address), “pi” (your Raspberry PI user)
    • Don’t write anything at “private key”, click “Next”
    • There will be error window with: “Device test failed” > Cancel
    • Authentication type → choose: “Default”
    • Now test connection (“Test” button) and after you give the password to the RPi it should be successful
    • Kits > Compilers > Add > GCC > C
    • Write: “GCC (Raspberry Pi)” as your custom name and: “~/raspi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/arm-linux-gnueabihf-gcc” as the path to the compiler
    • Kits > Compilers > Add > GCC > C++
    • Write: “G++ (Raspberry Pi)” as your custom name and: “~/raspi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/arm-linux-gnueabihf-g++” as your path to the compiler
    • Regarding the debugger, you should install:
      [On Host]:
    sudo apt-get install gdb-multiarch
    

    I’m not sure if this is needed but you can also install on RPi:

    sudo apt-get install gdbserver
    
    • Kits > Debuggers > Add
    • Write: “GDB (Raspberry Pi)” as your custom name and “/usr/bin/gdb-multiarch” as the path to the debugger
    • Apply
    • Kits > Qt Version > Add
    • Write path: ~/raspi/qt5/bin/qmake
    • Write name: Qt %{Qt:Version} (qt5) Raspberry PI
    • Apply
    • Kits > Kits > Add
    • Name: Raspi
    • Device Type: Generic Linux Device
    • The Device is the one created in the previous step
    • We set the Sysroot to where we have the sysroot image: ~/raspi/sysroot
    • Set compilers: "GCC (Raspberry PI)" and "G++ (Raspberry PI)"
    • Set the Debugger to the one created previously
    • Use the Qt version we created previously
    • We don't need to set mkspec, so leave it empty.
    • OK
    • To enable your running application to have regular window do the following:
      Projects > Raspberry PI > Run > Environment > Batch Edit:
    DISPLAY=:0.0
    QT_QPA_PLATFORMTHEME=qt5ct
    XAUTHORITY=/home/pi/.Xauthority
    XDG_SESSION_TYPE=x11
    

    If you don’t do this your application after starting up will be shown full screen but you will see it only when directly connect a screen to Raspberry PI (VNC desktop sharing will show nothing)
    14) [on host] In your Raspberry PI project, in .pro file, you need to show where the executable file should be placed: (LINK):

    target.path = /home/pi
    INSTALLS += target
    

    So comment the previous settings, eg.:

    # qnx: target.path = /tmp/$${TARGET}/bin
    # else: unix:!android: target.path = /opt/$${TARGET}/bin
    # !isEmpty(target.path): INSTALLS += target
    
    1. [on host] If you get: “WARNING: The code model could not parse a included file, which might lead to incorrect code completion and highlighting”:
      You need to deselect “ClangCodeModel” in HELP > ABOUT PLUGINS and restart QtCreator (LINK).
    2. You should be able to build/run/debug your project on RPi and connect to the MySQL database without "QMYSQL driver not loaded" error.

    If the above was useful for you please upvote this solution so that other people could find it easier.