Qt - 4.7.3 - How to make static build
I used 4.7.2 for the past months. Now I downloaded 4.7.3. Now I 开发者_开发百科am searching to type "configure -static". But I don't know where the hell "the qt path". Can anybody shed a light on this issue.
Download the source package here. Download and install your favorite perl distribution. I must warn you that Strawberry perl comes with its own toolchain and that may get used instead of the MinGW you downloaded. Use ActivePerl if you don't want any trouble, or build it yourself.
Unzip it to say,
C:\Qt-source
so that there is aconfigure.exe
inC:\Qt-source
Open the toolchain's command prompt
a) If you're using the Visual Studio compiler, search in the "start" menu for a CMD shortcut in the Visual Studio folder. The Windows SDK also has this shortcut.
b) If you're using MinGW, either use the accompanying
mingwvars.cmd
, or open a command prompt, (Run->"cmd.exe") and typeset PATH=C:\path\to\mingw\bin;%PATH%
. Trygcc -v
to see if it can be found.Make a build directory, preferable something like
C:\Qt
. Doset QTPATH=C:\Qt
andset PATH=C:\Qt\bin;%PATH%
andcd C:\Qt
, and type:..\Qt-source\configure -static
After configure finishes, you'll either have to type
nmake
(Visual Studio) ormingw32-make
.Go do something else, because it will take a while.
Some tips that result from my experience, and add a bit more to the answer of rubenv:
- Pass the install directory as a flag of the configure; be sure to choose a different directory from the one where you have stored a non-static version of Qt!
- Some modules will likely cause you troubles when compiling statically because you need to resolve the dependencies statically; one example is webkit, so if you don't need it be sure to disable it
- It is generally not a good idea to build the debug symbols into a static library, so I normally debug with the dynamic version, and use the static Qt to generate releases only.
Therefore, my configure looks something like this:
configure -static -prefix C:\Qt\4.8.6_static -no-webkit -release
精彩评论