Have someone accomplished Building Qt under a Static Build?
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...
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.
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!
Well, it really isn't that difficult to do. Just takes a lot of time ;-)
Anyway, I wrote down some hints here:
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.
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!)
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?
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.
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?
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)
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!!
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:
Checking the compilation with MSVC2010 ... let's wait
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
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!!!
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.
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?