Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Creating Mingw-64 static Qt



  • I deploy my programs in Windows as single-file executables.
    To do this, some years ago I created a Win32 static version of Qt 5.7 using Mingw32, which I still use.

    Now, I would like to repeat this using Mingw64. Unfortunately the instructions in https://wiki.qt.io/Building_a_static_Qt_for_Windows_using_MinGW
    are for Win32.
    I tried to adapt them to the Mingw64, but I incurred in a trivial but nasty issue:
    I must change
    configure -platform mingw32--g++
    into something good for Mingw64, but I cannot envisage what to specify as "platform,"
    More in general, I would like to have some "how-to" to get a running static version of Qt for Minw64, similar to the one in https://wiki.qt.io/Building_a_static_Qt_for_Windows_using_MinGW

    The instructions in
    https://forum.qt.io/topic/78052/installing-qt-64bit-and-qt-static-64-bit-on-windows-7/2
    seem to be what I need, but they do not give any control on which version to compile and on where to install stuff (I would like not to spoil my precious C-disk space, which is a fast SSD, with small capacity)

    Has anyone experience in such things?

    Thanks.



  • I have never built Qt for 64 bits on Windows, but what would happen if you had the 64 bits MinGW in your PATH instead of the 32 bits one while building?



  • In configure.bat I have several commands referring to Mingw32:

    configure -platform mingw32--g++
    ...
    mingw32-make -k -j4
    mingw32-make -k install
    It also somehow patches mkspecs for static build of an application

    So it seems a more complex task than just adjusting a path.

    However, I'll try a bit more to follow your hint. Even though I remember that making (somehow) blind attemtps in this field is crazily time consuming: errors can occur after several hours of PC activity (configuration, compilation).



  • Maybe MSYS2 would be a better environment for you. I feel like configure.sh is way better than configure.bat for custom builds.



  • I did it! I used
    https://forum.qt.io/topic/78052/installing-qt-64bit-and-qt-static-64-bit-on-windows-7/2

    For history:

    1. I installed msys2 in a secondary, magnetic HD and checked that it installs its stuff (compilers, compiled stuff) in the same HD, so I would not interfere with my smaller SSD
    2. I tried the procedure in the above link but got a virus warning from Norton. I don't know whether it is a false positive, but for maximum security, I interrupted the process
    3. therefore I tried the same procedure inside an Oracle Virtual Box running Win7 64 bit. It worked.

    Probably the procedure is not optimized since occupied 32 GB, but the target of having a system to create 64-bit Windows executable from my sources is reached.



  • Building for debug with MinGW can result in really large binary files. It's most likely not your fault.


Log in to reply