Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. How to add QMySQL driver for Raspberry Pi?
Forum Updated to NodeBB v4.3 + New Features

How to add QMySQL driver for Raspberry Pi?

Scheduled Pinned Locked Moved Solved Installation and Deployment
15 Posts 4 Posters 8.8k Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • SGaistS Offline
    SGaistS Offline
    SGaist
    Lifetime Qt Champion
    wrote on last edited by
    #6

    Seems like you didn't install the MySQL client libraries on your RPi3.

    If you can't find the mysql.pro file it's likely that you didn't download Qt's sources.

    Interested in AI ? www.idiap.ch
    Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

    J 1 Reply Last reply
    0
    • SGaistS SGaist

      Seems like you didn't install the MySQL client libraries on your RPi3.

      If you can't find the mysql.pro file it's likely that you didn't download Qt's sources.

      J Offline
      J Offline
      JamesDin
      wrote on last edited by JamesDin
      #7

      @SGaist

      I installed MySQL client libraried on my RPI3. libmysqlclient.so file could be found.
      And I didn't download Qt sources like you said.
      Because I thought that the MySQL driver for RPI would be made by cross-compilation.
      (MySQL driver for RPI is built on linux machine and is transferd into RPI.)
      Should I have both Qt source and MySQL client libraries in RPI3 and follow above instructions for building driver?

      1 Reply Last reply
      0
      • SGaistS Offline
        SGaistS Offline
        SGaist
        Lifetime Qt Champion
        wrote on last edited by
        #8

        My bad, I forgot you cross-compiled so you already should have the sources for that.

        If the MySQL dev package wasn't installed when cross-compiling Qt, then the driver won't be built. You can however follow the documentation by using the qmake from your cross-compiled Qt and the path to the sysroot where the libraries/headers can be found.

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        J 1 Reply Last reply
        0
        • SGaistS SGaist

          My bad, I forgot you cross-compiled so you already should have the sources for that.

          If the MySQL dev package wasn't installed when cross-compiling Qt, then the driver won't be built. You can however follow the documentation by using the qmake from your cross-compiled Qt and the path to the sysroot where the libraries/headers can be found.

          J Offline
          J Offline
          JamesDin
          wrote on last edited by
          #9

          @SGaist

          I solved the problem. Thank you very much!!! :D

          1 Reply Last reply
          0
          • SGaistS Offline
            SGaistS Offline
            SGaist
            Lifetime Qt Champion
            wrote on last edited by
            #10

            You're welcome !

            What was the problem in the end ?

            Interested in AI ? www.idiap.ch
            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

            J 1 Reply Last reply
            0
            • SGaistS SGaist

              You're welcome !

              What was the problem in the end ?

              J Offline
              J Offline
              JamesDin
              wrote on last edited by JamesDin
              #11

              @SGaist

              I did 'qmake' that was created by cross-compilation as your guide.
              After that, compiled MySQL driver was copied into mounted RPI image.
              My mistake is that I understood instruction is need to be done on RPI.

              A 1 Reply Last reply
              0
              • SGaistS Offline
                SGaistS Offline
                SGaist
                Lifetime Qt Champion
                wrote on last edited by
                #12

                Cross-compilation is a tricky subject.

                Happy coding ! :)

                Interested in AI ? www.idiap.ch
                Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                1 Reply Last reply
                0
                • J JamesDin

                  @SGaist

                  I did 'qmake' that was created by cross-compilation as your guide.
                  After that, compiled MySQL driver was copied into mounted RPI image.
                  My mistake is that I understood instruction is need to be done on RPI.

                  A Offline
                  A Offline
                  andquesada
                  wrote on last edited by andquesada
                  #13

                  @JamesDin

                  Hi!

                  So I followed the instructions here to cross-build a MySql driver. I have the same environment as you but I get this error:
                  Project ERROR: Library 'mysql' is not defined.

                  I am using Ubuntu Mate on my Raspberry Pi 3.

                  mysql_config --include says -I/usr/include/mysql
                  mysql_config --libs says -L/usr/lib/arm-linux-gnueabihf -lmysqlclient -lpthread -lz -lm -lrt -ldl

                  So the line to compile I am using is:
                  ${CROSS_BUILT_QMAKE}/./qmake "INCLUDEPATH+=${SYSROOT}/usr/include/mysql" "LIBS+=-L${SYSROOT}/usr/lib/arm-linux-gnueabihf -lmysqlclient_r" mysql.pro

                  Any help would be appretiated.

                  Thank you!

                  1 Reply Last reply
                  0
                  • H Offline
                    H Offline
                    Hervinsen
                    wrote on last edited by
                    #14

                    @SGaist
                    Hello, I am new in Qt programming, I have the same situation as sir @andquesada . When i want to qmake the sql driver, the output is : Project ERROR: Library 'mysql' is not defined.

                    Hope that you can help us. Thx

                    1 Reply Last reply
                    0
                    • SGaistS Offline
                      SGaistS Offline
                      SGaist
                      Lifetime Qt Champion
                      wrote on last edited by
                      #15

                      Which version of Qt are you trying to build ?

                      Interested in AI ? www.idiap.ch
                      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                      1 Reply Last reply
                      0

                      • Login

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • Users
                      • Groups
                      • Search
                      • Get Qt Extensions
                      • Unsolved