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. Static build with mysql
QtWS25 Last Chance

Static build with mysql

Scheduled Pinned Locked Moved Unsolved Installation and Deployment
9 Posts 5 Posters 2.6k Views
  • 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.
  • C Offline
    C Offline
    caiomarcos
    wrote on last edited by caiomarcos
    #1

    I have a project that is working well and fine with dynamic libraries, but now I want to deploy it using static libraries.
    I tried to build Qt static but I can't get it to have mysql drivers.

    I followed these instructions https://retifrav.github.io/blog/2018/02/17/build-qt-statically/ but on configure summary I have

    Qt Sql:
      DB2 (IBM) .............................. no
      InterBase .............................. no
      MySql .................................. no
      OCI (Oracle) ........................... no
      ODBC ................................... no
      PostgreSQL ............................. no
      SQLite2 ................................ no
      SQLite ................................. yes
        Using system provided SQLite ......... no
      TDS (Sybase) ........................... no
    

    How should I proceed?

    Edit:
    Forgot to mention - I'm on a Lubuntu (ubuntu) 18.04 with Qt 5.11.2.

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

      Hi and welcome to devnet,

      Do you have the MySQL development libraries installed on your machine ?

      By the way, don't forget the constraints of the LGPL regarding static builds of your application.

      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
      2
      • C Offline
        C Offline
        caiomarcos
        wrote on last edited by
        #3

        Didn't have those libraries, but now I believe I do (libmysqlclient-dev).

        From what I gathered, I should now build the mysql plugin as static, somewhere in {qt folder}/qtbase/src/plugins/sqldrivers, and then when I build static Qt it will find the relevant static libraries for MySql. Am I correct?

        But I can't find how to build the static mysql plugin for Qt. Any hint on how to do this?

        As for the licenses, the app will be of very limited, internal use, so I guess no worries about that.

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

          No, you build all of Qt statically from the start. In the absolute, you should start with only qtbase and then add the other modules you might need. You can also use the -skip option to avoid building everything that you don't need and do a one pass build.

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

          kshegunovK 1 Reply Last reply
          0
          • SGaistS SGaist

            No, you build all of Qt statically from the start. In the absolute, you should start with only qtbase and then add the other modules you might need. You can also use the -skip option to avoid building everything that you don't need and do a one pass build.

            kshegunovK Offline
            kshegunovK Offline
            kshegunov
            Moderators
            wrote on last edited by
            #5

            I'm not fully convinced that building a static Qt will link the mysql client library statically, though. I couldn't see anything to indicate it in the project file too ...

            Read and abide by the Qt Code of Conduct

            1 Reply Last reply
            0
            • C caiomarcos

              Didn't have those libraries, but now I believe I do (libmysqlclient-dev).

              From what I gathered, I should now build the mysql plugin as static, somewhere in {qt folder}/qtbase/src/plugins/sqldrivers, and then when I build static Qt it will find the relevant static libraries for MySql. Am I correct?

              But I can't find how to build the static mysql plugin for Qt. Any hint on how to do this?

              As for the licenses, the app will be of very limited, internal use, so I guess no worries about that.

              JonBJ Offline
              JonBJ Offline
              JonB
              wrote on last edited by
              #6

              @caiomarcos
              I don't know, but should you have a read through the findings in https://forum.qt.io/topic/94378/qt-static-with-mysql-issue ?

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

                @kshegunov good point, I misread that part of @caiomarcos post. I'm not even sure Linux distributions provides static versions of their libraries (I highly doubt that).

                So to answer that point, no, building a static Qt doesn't mean that it will look for all its dependencies as static libraries too.

                That's a subtlety many new developers don't know: a static library can have dynamic dependencies and if you want a full static library you have to get all its dependencies as full static libraries too.

                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
                2
                • C Offline
                  C Offline
                  caiomarcos
                  wrote on last edited by
                  #8

                  Thank you all.

                  I had no idea it would be this much trouble.

                  My experience is in microcontroller programming, bare metal and the eventual RTOS, so all this is very foreign to me.

                  I guess I'll figure out something else, maybe prepare the environment throughout on the target instead of relying on a static build or whatever.

                  Thanks again, I'll leave this for later.

                  C 1 Reply Last reply
                  0
                  • C caiomarcos

                    Thank you all.

                    I had no idea it would be this much trouble.

                    My experience is in microcontroller programming, bare metal and the eventual RTOS, so all this is very foreign to me.

                    I guess I'll figure out something else, maybe prepare the environment throughout on the target instead of relying on a static build or whatever.

                    Thanks again, I'll leave this for later.

                    C Offline
                    C Offline
                    cawlfj
                    wrote on last edited by
                    #9

                    @caiomarcos
                    he got succeed , but i can't get what he did.

                    FYR
                    https://forum.qt.io/topic/94378/qt-static-with-mysql-issue

                    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