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. Building static libraries
Forum Updated to NodeBB v4.3 + New Features

Building static libraries

Scheduled Pinned Locked Moved Installation and Deployment
11 Posts 3 Posters 14.5k 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.
  • G Offline
    G Offline
    gaminn
    wrote on last edited by
    #1

    Hello all,
    I need all my exes to use static libraries instead of dlls. So I downloaded Qt libraries source: qt-everywhere-opensource-src-4.8.2.tar.gz

    I unpacked it to C:\Qt\4.8.2_static

    I followed these instructions: http://www.qtcentre.org/wiki/index.php?title=Building_static_Qt_on_Windows => I edited C:\Qt\4.8.2_static\mkspecs\win32-g++\qmake.conf , then ran C:\Qt\4.8.2_static\configure.exe -static -release -no-exceptions and then I coppied mingw32-make.exe to C:\Qt\4.8.2_static and ran it. After few hours build was done.

    In Qt Creator 2.4.1 I would like to add new version of Qt so I can use my static libraries => Tools -> Build & Run -> Qt Versions. It needs qmake.exe location, but I can't see any qmake.exe in C:\Qt\4.8.2_static. What I missed during building my static libraries?

    Please can you provide correct steps how to build static libraries and integrate them to my Qt Creator 2.4.1? I'm not an expert and I don't understand well the proccess of building static libraries, so please be patient with me.

    Thank you

    Martin

    1 Reply Last reply
    0
    • R Offline
      R Offline
      raaghuu
      wrote on last edited by
      #2

      its in the bin directory(c:\QT\4.8.2_static\bin\qmake.exe)

      1 Reply Last reply
      0
      • E Offline
        E Offline
        eshimischi
        wrote on last edited by
        #3

        u don't need to put your mingw32-make into Qt build folder, if you have your MinGW (by the way what's the version of your gcc? try to ask the command gcc -v in command line), just make your MinGW into your PATH - open Start->My Computer preferences and see System Paths there->find PATH and put C:\MinGW\bin with ;

        then try to see qmake.exe in qmake folder and bin/ in your Qt build - can u see it? if you haven't got any troubles in compilation - it is strange that u don't have it

        1 Reply Last reply
        0
        • G Offline
          G Offline
          gaminn
          wrote on last edited by
          #4

          No, it is not, there is no exe nor dll in c:\QT\4.8.2_static\bin. Do I have to do again the build proccess? How should I modify it so qmake.exe is created?

          1 Reply Last reply
          0
          • R Offline
            R Offline
            raaghuu
            wrote on last edited by
            #5

            well qmake is the first thing that is built...try this link http://developer.qt.nokia.com/wiki/How_to_build_a_static_Qt_version_for_Windows_with_gcc

            1 Reply Last reply
            0
            • E Offline
              E Offline
              eshimischi
              wrote on last edited by
              #6

              try it: http://qt-project.org/forums/viewthread/1590
              http://stackoverflow.com/questions/1011197/qt-static-linking-and-deployment
              http://qt-project.org/forums/viewthread/13404

              i suppose u don't even need to compile qt by yourself

              1 Reply Last reply
              0
              • R Offline
                R Offline
                raaghuu
                wrote on last edited by
                #7

                [quote author="gaminn" date="1340443863"]then I coppied mingw32-make.exe to C:\Qt\4.8.2_static and ran it. After few hours build was done.[/quote]
                this is a mistake...the build cannot have completed(or even started)...mingw32-make alone doesn't do anything(i think)...you need whole minGW compiler(instead of copying, you should add the path of mingw32-make to the PATH environment variable)...
                neways, i've tried building static libraries many times but some problem always crops up...and it doesn't have any advantage over distributing your program with dll's(except perhaps the no. of files to be given...but that problem can be easily overcome by packing all required files in a .zip or .msi package before distributing)....

                1 Reply Last reply
                0
                • G Offline
                  G Offline
                  gaminn
                  wrote on last edited by
                  #8

                  I found out that in C:\QtSDK\Desktop\Qt\4.8.1\mingw\lib I have Qt static libs already compiled (there are files like libQtCore4.a, libQtGui4.a, ....). How can I tell compiler to link them?

                  I edited C:\QtSDK\Desktop\Qt\4.8.1\mingw\mkspecs\win32-g++\qmake.conf
                  QMAKE_LFLAGS = -static -static-libgcc
                  but this is obviously not sufficient.

                  What else should I do to link statically? Dependency Walker still shows dll dependecies of my exe.

                  Thanks

                  1 Reply Last reply
                  0
                  • R Offline
                    R Offline
                    raaghuu
                    wrote on last edited by
                    #9

                    those are not static libraries...ref to my earlier post, your static build was not completed

                    1 Reply Last reply
                    0
                    • G Offline
                      G Offline
                      gaminn
                      wrote on last edited by
                      #10

                      Libraries in C:\QtSDK\Desktop\Qt\4.8.1\mingw\lib are part of QtSdk-offline-win-x86-v1_2_1.exe installer (downloaded from qt.nokia.com), they weren't compiled by me. So I think I don't have to build them because I already have them. If I'm right there is only one thing I have to do - to instruct linker to link my Qt .pro project statically. Please help. Thank you.

                      1 Reply Last reply
                      0
                      • R Offline
                        R Offline
                        raaghuu
                        wrote on last edited by
                        #11

                        the installer you used is the one i used too...it builds dynamically linking Qt libs... to link statically you need to build static version of qt(instructions for which are given in the many links provided in earlier posts)

                        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