I am currently writing code in Qt. How to compile the code statically?
From Qt document I came to know the following step
1) Visual Studio 2008 -> commandPrompt -> QtDir -> configure -static -> nmake
But, it took 17 GB and at the end it exited before the completion stating that "the space is not enough".
Is there any simple way to compile the Qt application as a stand alone program?
Building Qt for Static LinkingTo use static linking, Qt must be built with the -static configuration option. The following configure command selects the correct options and sysroot for the Raspberry Pi 2.
Our Qt libraries have been built using dynamic linking, preventing any customer application to use them with static linking.
To build the Qt project as a standalone executable file run qmake and nmake. After that you should execute mt.exe to embed a manifest inside the application to avoid error such as missing MSVCP90. dll when the application is started on other computers.
You have already used the only way possible: compiling the source as static.
Some things that have a very large impact on disk size (which seems to be the problem here), with corresponding configure arguments:
-release
-no-webkit -no-script -no-scripttools -no-qt3support -nomake demos -nomake tools -nomake examples
no-ltcg
These should help keep the build size to a minimum.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With