Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Trouble linking to Qt libraries statically.

Trouble linking to Qt libraries statically.

Scheduled Pinned Locked Moved General and Desktop
6 Posts 3 Posters 5.3k 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.
  • P Offline
    P Offline
    pwnstar23
    wrote on last edited by
    #1

    I found that I can link mingw runtimes statically using
    QMAKE_LFLAGS = -static -static-libgcc
    This works fine.

    I also found that people in the past have been able to link to Qt libraries statically using
    CONFIG += static
    or
    CONFIG += staticlib

    This does not work for me, I still get the popup saying cannot find (QtCore.dll) or some other dll from Qt. When I run the exe directly from the build folder.

    I am using Qt 5.0.2 32bit mingw SDK. Windows 7 64bit os. How can I get it to link qt statically.

    I am aware of the licensing issues. This is open source application so I am covered by GPL.

    1 Reply Last reply
    0
    • raven-worxR Offline
      raven-worxR Offline
      raven-worx
      Moderators
      wrote on last edited by
      #2

      did you also compile Qt itself as static lib?

      --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
      If you have a question please use the forum so others can benefit from the solution in the future

      1 Reply Last reply
      0
      • P Offline
        P Offline
        pwnstar23
        wrote on last edited by
        #3

        I looked in the lib folder of the sdk and there was libxxxx.a for each qt dll. And the sizes are similar for example qtcore.dll is 4mb, and libqtcore.a is 3.9mb isn't this a statically built Qt?

        1 Reply Last reply
        0
        • raven-worxR Offline
          raven-worxR Offline
          raven-worx
          Moderators
          wrote on last edited by
          #4

          only if you built Qt twice ... once with dynamic and once with static linking...
          SInce you have DLLs in there too.
          Whats the content of the file: <qt-dir>/qtbase/config.summary

          --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
          If you have a question please use the forum so others can benefit from the solution in the future

          1 Reply Last reply
          0
          • P Offline
            P Offline
            pwnstar23
            wrote on last edited by
            #5

            I never built qt I'm using the sdk, and it appears to have the pre built .a files.

            1 Reply Last reply
            0
            • Q Offline
              Q Offline
              qxoz
              wrote on last edited by
              #6

              [quote author="pwnstar23" date="1370554593"]I never built qt I'm using the sdk, and it appears to have the pre built .a files.[/quote]
              You need build Qt staticaly, .a files in prebuild binaries are for linking with dinamic libs. "Take a look":http://qt-project.org/wiki/How_to_build_a_static_Qt_version_for_Windows_with_gcc.

              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