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

Share a static build of Qt 5.12.1



  • Hi!

    I'm trying to share the static Qt Kit version that I compile but it is throwing errors during app building due to missing mingw static dependencies. (That took me the whole day)

    The Qt source code that I'm using is the following:

    https://download.qt.io/archive/qt/5.12/5.12.10/single/
    

    I added to the enviroment PATH the bin folder of my current QT installation

    D:\ideSoftware\Qt\Tools\mingw810_64\bin
    

    I configure the building and installation as is indicated by the following commands:

    configure -prefix D:\ideSoftware\Qt\5.12.10_static -static -release -static-runtime -skip webengine  -opensource -nomake tests -nomake tools -nomake examples -opengl desktop -platform win32-g++
    mingw32-make - j4
    mingw32-make install
    

    In my machine the Static Kit Version was installed here:

    D:\ideSoftware\Qt\5.12.10_static
    

    I moved the folder and rename it to the next path:

    D:\ideSoftware\Qt\5.12.10\mingw810_64_static
    

    Then I copy the qt.conf file to the Kit's bin folder with the following content:

    [EffectivePaths]
    Prefix=..
    [DevicePaths]
    Prefix=D:/ideSoftware/Qt/5.12.10/mingw810_64_static
    [Paths]
    Prefix=D:/ideSoftware/Qt/5.12.10/mingw810_64_static
    HostPrefix=D:/ideSoftware/Qt/5.12.10/mingw810_64_static
    Sysroot=
    SysrootifyPrefix=false
    TargetSpec=win32-g++
    HostSpec=win32-g++
    

    That works good for my machine, but when I copy the Kit in other machine I got errors like this:

    error: D:\ideSoftware\Qt\Tools\mingw810_64\lib\libz.a: No such file or directory
    

    Note that MINGW is not installed here in the other machine:

    D:\ideSoftware\Qt\Tools\mingw810_64
    

    The following is the log:

    g++ -static-libgcc -static-libstdc++ -Wl,-Bstatic,--whole-archive -lwinpthread -Wl,--no-whole-archive -Wl,-s -Wl,-subsystem,console -static -Wl,--gc-sections -mthreads -o release\Testing_ffmpeg.exe @object_script.Testing_ffmpeg.Release  -lavcodec -lavdevice -lavfilter -lavformat -lavutil -lswresample -lswscale -lpostproc -lx265 -laom -lSvtAv1Dec -lSvtAv1Enc -LD:\Proyectos_Qt\libs\ffmpeg\ffmpeg_lib_win64 -LD:\Proyectos_Qt\libs\FreeImage\Dist\x64 -lFreeImage D:\Qt\5.12.10_static\plugins\platforms\libqwindows.a -ldwmapi -lwinspool -lopengl32 -lshlwapi -lwtsapi32 D:\Qt\5.12.10_static\lib\libQt5EventDispatcherSupport.a D:\Qt\5.12.10_static\lib\libQt5FontDatabaseSupport.a D:\Qt\5.12.10_static\lib\libqtfreetype.a D:\ideSoftware\Qt\Tools\mingw810_64\x86_64-w64-mingw32\lib\libdwrite.a D:\ideSoftware\Qt\Tools\mingw810_64\x86_64-w64-mingw32\lib\libd2d1.a D:\Qt\5.12.10_static\lib\libQt5ThemeSupport.a D:\Qt\5.12.10_static\lib\libQt5AccessibilitySupport.a D:\Qt\5.12.10_static\lib\libQt5WindowsUIAutomationSupport.a D:\Qt\5.12.10_static\plugins\imageformats\libqgif.a D:\Qt\5.12.10_static\plugins\imageformats\libqicns.a D:\Qt\5.12.10_static\plugins\imageformats\libqico.a D:\Qt\5.12.10_static\plugins\imageformats\libqjpeg.a D:\Qt\5.12.10_static\plugins\imageformats\libqtga.a D:\Qt\5.12.10_static\plugins\imageformats\libqtiff.a D:\Qt\5.12.10_static\plugins\imageformats\libqwbmp.a D:\Qt\5.12.10_static\plugins\imageformats\libqwebp.a D:\Qt\5.12.10_static\lib\libQt5Gui.a D:\Qt\5.12.10_static\lib\libqtlibpng.a D:\Qt\5.12.10_static\lib\libqtharfbuzz.a -lgdi32 -lcomdlg32 -loleaut32 -limm32 D:\ideSoftware\Qt\Tools\mingw810_64\x86_64-w64-mingw32\lib\libglu32.a D:\ideSoftware\Qt\Tools\mingw810_64\x86_64-w64-mingw32\lib\libopengl32.a D:\ideSoftware\Qt\Tools\mingw810_64\x86_64-w64-mingw32\lib\libgdi32.a D:\ideSoftware\Qt\Tools\mingw810_64\x86_64-w64-mingw32\lib\libuser32.a D:\Qt\5.12.10_static\lib\libQt5Concurrent.a D:\Qt\5.12.10_static\lib\libQt5Core.a -lmpr -lnetapi32 -luserenv -lversion -lws2_32 -lkernel32 -luser32 -lshell32 -luuid -lole32 -ladvapi32 -lwinmm D:\ideSoftware\Qt\Tools\mingw810_64\x86_64-w64-mingw32\lib\libz.a D:\Qt\5.12.10_static\lib\libqtpcre2.a  D:\ideSoftware\Qt\Tools\mingw810_64\x86_64-w64-mingw32\lib\libglu32.a D:\ideSoftware\Qt\Tools\mingw810_64\x86_64-w64-mingw32\lib\libopengl32.a D:\ideSoftware\Qt\Tools\mingw810_64\x86_64-w64-mingw32\lib\libgdi32.a D:\ideSoftware\Qt\Tools\mingw810_64\x86_64-w64-mingw32\lib\libuser32.a 
    g++: error: D:\ideSoftware\Qt\Tools\mingw810_64\x86_64-w64-mingw32\lib\libdwrite.a: No such file or directory
    g++: error: D:\ideSoftware\Qt\Tools\mingw810_64\x86_64-w64-mingw32\lib\libd2d1.a: No such file or directory
    g++: error: D:\ideSoftware\Qt\Tools\mingw810_64\x86_64-w64-mingw32\lib\libglu32.a: No such file or directory
    g++: error: D:\ideSoftware\Qt\Tools\mingw810_64\x86_64-w64-mingw32\lib\libopengl32.a: No such file or directory
    g++: error: D:\ideSoftware\Qt\Tools\mingw810_64\x86_64-w64-mingw32\lib\libgdi32.a: No such file or directory
    g++: error: D:\ideSoftware\Qt\Tools\mingw810_64\x86_64-w64-mingw32\lib\libuser32.a: No such file or directory
    g++: error: D:\ideSoftware\Qt\Tools\mingw810_64\x86_64-w64-mingw32\lib\libz.a: No such file or directory
    g++: error: D:\ideSoftware\Qt\Tools\mingw810_64\x86_64-w64-mingw32\lib\libglu32.a: No such file or directory
    g++: error: D:\ideSoftware\Qt\Tools\mingw810_64\x86_64-w64-mingw32\lib\libopengl32.a: No such file or directory
    g++: error: D:\ideSoftware\Qt\Tools\mingw810_64\x86_64-w64-mingw32\lib\libgdi32.a: No such file or directory
    g++: error: D:\ideSoftware\Qt\Tools\mingw810_64\x86_64-w64-mingw32\lib\libuser32.a: No such file or directory
    mingw32-make[1]: *** [Makefile.Release:522: release/Testing_ffmpeg.exe] Error 1
    mingw32-make[1]: Leaving directory 'D:/Proyectos_Qt/build-Testing_ffmpeg-Clone_of_Desktop_Qt_5_12_1_MinGW_8_10_64_bit_static-Release'
    mingw32-make: *** [Makefile:38: release] Error 2
    16:43:02: The process "D:\Qt\Qt5.12.1\5.12.1\mingw64-8.10\mingw64\bin\mingw32-make.exe" exited with code 2.
    Error while building/deploying project Testing_ffmpeg (kit: Clone of Desktop Qt 5.12.1 MinGW 8.10 64-bit (static))
    When executing step "Make"
    16:43:02: Elapsed time: 03:12.
    

  • Lifetime Qt Champion

    Since your static qt build is also using the static libz.a for example you have to give them to the linker. If they're not available you will get the errors above.



  • Just link the libraries doesn't seem to work.

    I try to replace, in each .prl file in <Kit_path>/lib, the hardcoded path D:\ideSoftware\Qt\Tools\mingw810_64\x86_64-w64-mingw32\lib to D:\Qt\Tools\mingw81_64\x86_64-w64-mingw32\lib

    And it seems to fix some of the compiling issues but the following errors still remains:

    g++: error: D:\ideSoftware\Qt\Tools\mingw810_64\x86_64-w64-mingw32\lib\libglu32.a: No such file or directory
    g++: error: D:\ideSoftware\Qt\Tools\mingw810_64\x86_64-w64-mingw32\lib\libopengl32.a: No such file or directory
    g++: error: D:\ideSoftware\Qt\Tools\mingw810_64\x86_64-w64-mingw32\lib\libgdi32.a: No such file or directory
    g++: error: D:\ideSoftware\Qt\Tools\mingw810_64\x86_64-w64-mingw32\lib\libuser32.a: No such file or directory
    

    I'm not sure why the Makefile.Release is still appending the old references. As you can see both libraries are linked the new one and the old one:
    D:\Qt\Tools\mingw81_64\x86_64-w64-mingw32\lib\libglu32.a
    D:\ideSoftware\Qt\Tools\mingw810_64\x86_64-w64-mingw32\lib\libglu32.a

    LIBS        =        -lavcodec -lavdevice -lavfilter -lavformat -lavutil -lswresample -lswscale -lpostproc -lx265 -laom -lSvtAv1Dec -lSvtAv1Enc -LD:\Projects\libs\ffmpeg\ffmpeg_lib_win64 -LD:\Projects\libs\FreeImage\Dist\x64 -lFreeImage D:\Qt\5.12.1\mingw81_64_static\plugins\platforms\libqwindows.a -ldwmapi -lwinspool -lopengl32 -lshlwapi -lwtsapi32 D:\Qt\5.12.1\mingw81_64_static\lib\libQt5EventDispatcherSupport.a D:\Qt\5.12.1\mingw81_64_static\lib\libQt5FontDatabaseSupport.a D:\Qt\5.12.1\mingw81_64_static\lib\libqtfreetype.a D:\Qt\Tools\mingw81_64\x86_64-w64-mingw32\lib\libdwrite.a D:\Qt\Tools\mingw81_64\x86_64-w64-mingw32\lib\libd2d1.a D:\Qt\5.12.1\mingw81_64_static\lib\libQt5ThemeSupport.a D:\Qt\5.12.1\mingw81_64_static\lib\libQt5AccessibilitySupport.a D:\Qt\5.12.1\mingw81_64_static\lib\libQt5WindowsUIAutomationSupport.a D:\Qt\5.12.1\mingw81_64_static\plugins\imageformats\libqgif.a D:\Qt\5.12.1\mingw81_64_static\plugins\imageformats\libqicns.a D:\Qt\5.12.1\mingw81_64_static\plugins\imageformats\libqico.a D:\Qt\5.12.1\mingw81_64_static\plugins\imageformats\libqjpeg.a D:\Qt\5.12.1\mingw81_64_static\plugins\imageformats\libqtga.a D:\Qt\5.12.1\mingw81_64_static\plugins\imageformats\libqtiff.a D:\Qt\5.12.1\mingw81_64_static\plugins\imageformats\libqwbmp.a D:\Qt\5.12.1\mingw81_64_static\plugins\imageformats\libqwebp.a D:\Qt\5.12.1\mingw81_64_static\lib\libQt5Gui.a D:\Qt\5.12.1\mingw81_64_static\lib\libqtlibpng.a D:\Qt\5.12.1\mingw81_64_static\lib\libqtharfbuzz.a -lgdi32 -lcomdlg32 -loleaut32 -limm32 D:\Qt\Tools\mingw81_64\x86_64-w64-mingw32\lib\libglu32.a D:\Qt\Tools\mingw81_64\x86_64-w64-mingw32\lib\libopengl32.a D:\Qt\Tools\mingw81_64\x86_64-w64-mingw32\lib\libgdi32.a D:\Qt\Tools\mingw81_64\x86_64-w64-mingw32\lib\libuser32.a D:\Qt\5.12.1\mingw81_64_static\lib\libQt5Concurrent.a D:\Qt\5.12.1\mingw81_64_static\lib\libQt5Core.a -lmpr -lnetapi32 -luserenv -lversion -lws2_32 -lkernel32 -luser32 -lshell32 -luuid -lole32 -ladvapi32 -lwinmm D:\Qt\Tools\mingw81_64\x86_64-w64-mingw32\lib\libz.a D:\Qt\5.12.1\mingw81_64_static\lib\libqtpcre2.a  D:\ideSoftware\Qt\Tools\mingw810_64\x86_64-w64-mingw32\lib\libglu32.a D:\ideSoftware\Qt\Tools\mingw810_64\x86_64-w64-mingw32\lib\libopengl32.a D:\ideSoftware\Qt\Tools\mingw810_64\x86_64-w64-mingw32\lib\libgdi32.a D:\ideSoftware\Qt\Tools\mingw810_64\x86_64-w64-mingw32\lib\libuser32.a 
    

    I manually delete the last four lines but that is not a good way to share my static kit to my another machine.



  • I t seems to be work now.
    I need to perform the same path replacement in .cmake, .pri, .pc and .prl with "/" and "\" where the libs are added with the mingw hardcoded path.


Log in to reply