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. Have someone accomplished Building Qt under a Static Build?
Forum Updated to NodeBB v4.3 + New Features

Have someone accomplished Building Qt under a Static Build?

Scheduled Pinned Locked Moved General and Desktop
13 Posts 2 Posters 6.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.
  • A Offline
    A Offline
    AxDSan
    wrote on last edited by
    #1

    I have been playing around with settings on how to re-compile back libraries of Qt for windows for Qt to support Static building aka Standalone executables, but found nothing great, Apart from the versions that are supported are very old, I haven't found yet support for this kind of topic into Qt 5.0.0, I had found articles that describes how to Static Build Qt Libraries but they are all old, like for versions 4.7.0+ and Such...

    1 Reply Last reply
    0
    • M Offline
      M Offline
      MuldeR
      wrote on last edited by
      #2

      I always compile my Qt 4.8.x as "static" libraries ("click":http://tinyurl.com/bhwcxwr). Tried the same with one of the Qt 5 Beta's and it worked pretty much the same way. That is on Windows and with Visual Studio 2010/2012.

      My OpenSource software at: http://muldersoft.com/

      Qt v4.8.6 MSVC 2013, static/shared: http://goo.gl/BXqhrS

      Go visit the coop: http://youtu.be/Jay...

      1 Reply Last reply
      0
      • A Offline
        A Offline
        AxDSan
        wrote on last edited by
        #3

        Excelent!! This is what I was looking for!! I wanted to do static building/compliling for updated version (5.0.0) but never saw this! THANKS!

        1 Reply Last reply
        0
        • M Offline
          M Offline
          MuldeR
          wrote on last edited by
          #4

          Well, it really isn't that difficult to do. Just takes a lot of time ;-)

          Anyway, I wrote down some hints here:
          http://lamexp.sourceforge.net/doc/FAQ.html#87f001c0

          My OpenSource software at: http://muldersoft.com/

          Qt v4.8.6 MSVC 2013, static/shared: http://goo.gl/BXqhrS

          Go visit the coop: http://youtu.be/Jay...

          1 Reply Last reply
          0
          • A Offline
            A Offline
            AxDSan
            wrote on last edited by
            #5

            Ok now I have downloaded the 4.8.3 version static libraries but is only a 7z file with 2 main folders in it... bin and lib and other documents? What I have to do now?

            Btw Will I be able to use the Qt Creator IDE to use the Static Libraries and build static programs? that's my objective here... I mean use MSVC2010 as compiler but not its IDE instead use Qt Creator... etc, etc.

            1 Reply Last reply
            0
            • M Offline
              M Offline
              MuldeR
              wrote on last edited by
              #6

              Well, the 7-zip package contains the static Qt libraries, so what you are looking for are the .lib files in the "lib" folder. Some of the Qt tools (moc, rcc, uic, etc.) are included too. You find them in the "bin" folder. There obviously are no DLL's needed with the static builds. And the header files (.h) you can use from the official Qt distribution.

              (Just be sure you add the QT_NODLL pre-processor define to your project configuration!)

              My OpenSource software at: http://muldersoft.com/

              Qt v4.8.6 MSVC 2013, static/shared: http://goo.gl/BXqhrS

              Go visit the coop: http://youtu.be/Jay...

              1 Reply Last reply
              0
              • A Offline
                A Offline
                AxDSan
                wrote on last edited by
                #7

                the QT_NODLL define will be in the *.pro file right? if so how I declare it?

                DEFINE += QT_NODLL ?

                Just like that? and regarding the lib files do I copy n' paste them all into the current Qt 5.0.0 lib folder?

                1 Reply Last reply
                0
                • M Offline
                  M Offline
                  MuldeR
                  wrote on last edited by
                  #8

                  As my builds are Qt 4.8, you should use them with Qt 4.8 header files ;-)

                  Also I wouldn't mix those files with the official Qt distribution. Just link against the static .lib's from the directory where you have extracted them. I use Visual Studio, where I can add the "lib" path to "Additional Library Directories" under the "Linker" options. I add the .lib files that I want to link against under "Additional Dependencies". And "QT_NODLL" under "Preprocessor Definitions". There should be similar options in Qt Creator.

                  My OpenSource software at: http://muldersoft.com/

                  Qt v4.8.6 MSVC 2013, static/shared: http://goo.gl/BXqhrS

                  Go visit the coop: http://youtu.be/Jay...

                  1 Reply Last reply
                  0
                  • A Offline
                    A Offline
                    AxDSan
                    wrote on last edited by
                    #9

                    Ok but regarding the 5.0.0 libraries I saw an experimental folder in your projects hoster and you even said "Tried the same with one of the Qt 5 Beta’s and it worked pretty much the same way".

                    Now my question is how can I accomplish Static compiling under Qt 5.0.0? Adding the lib path to Qt Creator IDE compiler and the QT_NODLL under its preprosessor definition?

                    1 Reply Last reply
                    0
                    • M Offline
                      M Offline
                      MuldeR
                      wrote on last edited by
                      #10

                      Those builds in the "experimental" folder are Qt 5, but some old Beta (or even Alpha) release.

                      I would not recommend using those nowadays. Either use up-to-date Qt 4.8.4 or build Qt 5.0 yourself.

                      Building Qt 5 as "static" libs worked for me pretty much the same I build Qt 4.8.x as "static" libs.

                      (And I already posted a link with the steps I use to build my Qt 4.x static libs, should work for Qt 5 too)

                      My OpenSource software at: http://muldersoft.com/

                      Qt v4.8.6 MSVC 2013, static/shared: http://goo.gl/BXqhrS

                      Go visit the coop: http://youtu.be/Jay...

                      1 Reply Last reply
                      0
                      • A Offline
                        A Offline
                        AxDSan
                        wrote on last edited by
                        #11

                        Fatal Errors Everywhere -______- This seems to be a Mission Impossible for me...

                        I might just want to stick a bit more with those damned shared libraries and start giving out Dll's for everyone -.- OH MY!!

                        !http://i.imgur.com/sXyj2.png(OH MY)!

                        1 Reply Last reply
                        0
                        • M Offline
                          M Offline
                          MuldeR
                          wrote on last edited by
                          #12

                          Above you said that you "use MSVC2010 as compiler", but now you compile Qt with MinGW !?!?

                          If you are going to use MSVC to compile your app, the static Qt libs should be compiled with MSVC too.

                          Even the static libs compiled with MSVC 2010 don't work with MSVC 2012, and vice versa...

                          I have no experience with compiling Qt under MinGW, but I gave you the info how I do it with MSVC:
                          http://qt-project.org/forums/viewthread/23303/#108378

                          My OpenSource software at: http://muldersoft.com/

                          Qt v4.8.6 MSVC 2013, static/shared: http://goo.gl/BXqhrS

                          Go visit the coop: http://youtu.be/Jay...

                          1 Reply Last reply
                          0
                          • A Offline
                            A Offline
                            AxDSan
                            wrote on last edited by
                            #13

                            Checking the compilation with MSVC2010 ... let's wait

                            EDIT

                            Got passed through the second request which was nmake /B, that step always got me stuck in (while using mingw32-make sub-src cmd) now with MSVC2010 everything seems to be running quite smooth!!! no the off side this has is that is 1:56 AM for me! and this process ppl says takes to 40 mins to 4 hours depending on PC I got Win7 64Bit machine with AMD Athlon Dual Core @ 2.50GHz with 4GB RAM I hope this runs faster.. XD

                            2nd EDIT

                            Just can't believe this!!! I don't know if it's the whole process at all or just my lame computer... I'm compiling it and I have started the whole process at 1:something AM I left my PC overnight expecting that it would finish or something... for my surprise.......
                            IT STILL GOING!!!

                            !http://i.imgur.com/qP6Nt.png!

                            THIS PROCESS HAS GONE TOO FAR RUNNING WITH MORE THAN 10 HOURS!!!

                            Now going straight into my point... making sure I will get static libraries... once this whooole process finishes will I have Static, static, static libraries? I added the -static argument into the CMD line when launching the command, so that will mean I will have static libraries indeed? I just wanna make sure because I don't wanna have the disillusion myself knowing that happens to be like more than 9 hours and I still have shared libraries that would make me go insane right then.

                            3rd EDIT

                            Done!! DONE DONE DONE Finally! hahaha I'm so excited!! now that I have spent more than 10 hours is there a way I could make a backup of those libraries so I can later use them, If by some chances of life I loose them, or if I hit up with a virus and had to re-format my PC, is there a way I could deploy them over a new (other) fresh installation of Qt-5.0.0?

                            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