Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt
  • Unsolved
Collapse
qtws26_logo

The Qt Event of the Year: Qt World Summit 2026

Save Your Spot >
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Qt Static Build with SQL plugins/libs
Qt 6.12 LTS is out! See what's new in the release blog

Qt Static Build with SQL plugins/libs

Scheduled Pinned Locked Moved Unsolved General and Desktop
8 Posts 2 Posters 1.8k Views 1 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.
  • D Offline
    D Offline
    dalishi
    wrote on last edited by dalishi
    #1

    Hi, when I use the Qt help framework (QT += help), I feel that I introduce some plugin stuff like the SQL database, which is supposed to be also statically linked into the application. Still have no idea how to do this. However, when I list the linked libraries of the static built application (using ldd), there are still some shared SQL libraries which are not shipped with the system, meaning if you move onto anther machine, still need to install them for the application to run.

    	libmysqlclient.so.20 => /usr/lib/x86_64-linux-gnu/libmysqlclient.so.20
    	libodbc.so.2 => /usr/lib/x86_64-linux-gnu/libodbc.so.2
    	libpq.so.5 => /usr/lib/x86_64-linux-gnu/libpq.so.5
    

    In the configure of Qt static library, I saw some options related to SQL database, but have no idea how they are related:

      -sql-<driver> ........ Enable SQL <driver> plugin. Supported drivers:
                             db2 ibase mysql oci odbc psql sqlite2 sqlite tds
                             [all auto]
      -sqlite .............. Select used sqlite3 [system/qt]
    

    Is this the way or I should manually link to the static version of these SQL libraries? I'm using Qt5.12.0 on Ubunto16.04. Thanks.

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

      Hi,

      If you want a fully static application, then you have to link to all dependencies statically also.

      Just remember that you also have to abide by the licensing constraints if you are using the (L)GPL version of Qt.

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

      D 1 Reply Last reply
      1
      • SGaistS SGaist

        Hi,

        If you want a fully static application, then you have to link to all dependencies statically also.

        Just remember that you also have to abide by the licensing constraints if you are using the (L)GPL version of Qt.

        D Offline
        D Offline
        dalishi
        wrote on last edited by dalishi
        #3

        Hi @SGaist Noted the license constraints with thanks.

        May I know how to statically link this sql library? I can link all my other libraries statically but this one seems was linked by the Qt Help module and still not sure how to tell Qt to link the static version? I tried add LIBS += .......libmysqlclient.a but it does not work. Qt still looks for the shared version libmysqlclient.so.20.

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

          Do you have both in the same folder ?

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

          D 1 Reply Last reply
          0
          • SGaistS SGaist

            Do you have both in the same folder ?

            D Offline
            D Offline
            dalishi
            wrote on last edited by
            #5

            @SGaist yes they are both in /usr/lib/x86_64-linux-gnu/

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

              Then you should remove the dynamic version of the library.

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

              D 1 Reply Last reply
              0
              • SGaistS SGaist

                Then you should remove the dynamic version of the library.

                D Offline
                D Offline
                dalishi
                wrote on last edited by
                #7

                @SGaist Noted. Is there possible any way that I can tell Qt to link to the static version when I built the static Qt from source?

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

                  IIRC, you would have to put the whole path to the file that needs to get linked.

                  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
                  • Unsolved