Please nominate your Qt Champions for 2021! https://forum.qt.io/topic/132134/looking-for-the-2021-qt-champions

running static-deployed .exe in virtualbox fails with missing jpg/freetype/png.dlls



  • Hello,
    I don't fully understand, the point of static deploy would be to get rid of dll dependencies, no?

    I'm trying to deploy a win10 application that i made using qt 5.15.1 & qtcharts.
    I managed to build a static version of qt and linked my project against it, but when i try to launch it inside a vm, it fails on start,asking for the dlls i mentioned.

    Please help me out :(


  • Lifetime Qt Champion

    Hi,

    Using a static library does not mean said library does not have dynamic dependencies. On Windows for example, the shared C++ runtime is usually used.

    How exactly did you build Qt ?



  • Hello,

    I used the installer to acquire 5.15.1 source code, then ran configure using powershell:

    ./configure -static -static-runtime -release -platform win32-g++ -nomake tools -nomake tests -nomake examples -prefix "C:\QtStatic\"
    

    After this i invoked the makefile:

    mingw32-make -j6
    mingw32-make install -j6
    

    Then I built my project:

    C:\QtStatic\bin\qmake.exe -config release
    mingw32-make -j6
    

    Oddly enough, the makefile that was generated for my project contains the "missing" libraries:

    ...
    DEFINES       = -DUNICODE -D_UNICODE -DWIN32 -DMINGW_HAS_SECURE_API=1 -DQT_NO_DEBUG -DQT_CHARTS_LIB -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_NEEDS_QMAIN
    CFLAGS        = -fno-keep-inline-dllexport -O2 -Wall -Wextra -Wextra -ffunction-sections -fdata-sections $(DEFINES)
    CXXFLAGS      = -fno-keep-inline-dllexport -O2 -std=gnu++1y -Wall -Wextra -Wextra -ffunction-sections -fdata-sections -fexceptions -mthreads $(DEFINES)
    INCPATH       = -I. -I..\..\..\..\QtStatic\include -I..\..\..\..\QtStatic\include\QtCharts -I..\..\..\..\QtStatic\include\QtWidgets -I..\..\..\..\QtStatic\include\QtGui -I..\..\..\..\QtStatic\include\QtANGLE -I..\..\..\..\QtStatic\include\QtCore -Irelease -I. -I..\..\..\..\VulkanSDK\1.2.131.2\include -I..\..\..\..\QtStatic\mkspecs\win32-g++ 
    LINKER      =        g++
    LFLAGS        =        -Wl,-s -static -Wl,--gc-sections -Wl,-subsystem,windows -mthreads
    LIBS        =        C:\QtStatic\plugins\imageformats\libqjpeg.a -ljpeg C:\QtStatic\plugins\imageformats\libqgif.a C:\QtStatic\plugins\imageformats\libqtiff.a -ltiff C:\QtStatic\plugins\styles\libqwindowsvistastyle.a C:\QtStatic\plugins\platforms\libqwindows.a -lwinspool -lshlwapi -lwtsapi32 C:\QtStatic\lib\libQt5EventDispatcherSupport.a C:\QtStatic\lib\libQt5FontDatabaseSupport.a -lfontconfig -lfreetype -ldwrite -ld2d1 C:\QtStatic\lib\libQt5ThemeSupport.a C:\QtStatic\lib\libQt5AccessibilitySupport.a C:\QtStatic\lib\libQt5VulkanSupport.a C:\QtStatic\lib\libQt5WindowsUIAutomationSupport.a C:\QtStatic\plugins\imageformats\libqicns.a C:\QtStatic\plugins\imageformats\libqico.a C:\QtStatic\plugins\imageformats\libqtga.a C:\QtStatic\plugins\imageformats\libqwbmp.a C:\QtStatic\plugins\imageformats\libqwebp.a -lwebp -lwebpdemux -lwebpmux C:\QtStatic\lib\libQt5Charts.a C:\QtStatic\lib\libQt5Widgets.a -luxtheme -ldwmapi C:\QtStatic\lib\libQt5Gui.a -ld3d11 -ldxgi -ldxguid -lpng16 C:\QtStatic\lib\libqtharfbuzz.a -lgdi32 -lcomdlg32 -loleaut32 -limm32 C:\QtStatic\lib\libQt5Core.a -lmpr -luserenv -lversion -lz C:\QtStatic\lib\libqtpcre2.a -lnetapi32 -lws2_32 -ladvapi32 -lkernel32 -lole32 -lshell32 -luuid -luser32 -lwinmm  -lmingw32 C:\QtStatic\lib\libqtmain.a -lshell32 
    QMAKE         = C:\QtStatic\bin\qmake.exe
    ...
    

    My goal would be to be able to deploy a qt 5.15.1 application that uses widgets for ui & qtcharts, preferably as a single executable.


  • Lifetime Qt Champion

    What missing libraries are you referring to ?



  • libfreetype-6__.dll, libpng16-16__.dll, libtiff-5__.dll, libjpeg-9_.dll


  • Lifetime Qt Champion

    Do you have the static versions of these ?



  • LIBS        =        C:\QtStatic\plugins\imageformats\libqjpeg.a -ljpeg C:\QtStatic\plugins\imageformats\libqgif.a C:\QtStatic\plugins\imageformats\libqtiff.a -ltiff C:\QtStatic\plugins\styles\libqwindowsvistastyle.a C:\QtStatic\plugins\platforms\libqwindows.a -lwinspool -lshlwapi -lwtsapi32 C:\QtStatic\lib\libQt5EventDispatcherSupport.a C:\QtStatic\lib\libQt5FontDatabaseSupport.a -lfontconfig -lfreetype -ldwrite -ld2d1 C:\QtStatic\lib\libQt5ThemeSupport.a C:\QtStatic\lib\libQt5AccessibilitySupport.a C:\QtStatic\lib\libQt5VulkanSupport.a C:\QtStatic\lib\libQt5WindowsUIAutomationSupport.a C:\QtStatic\plugins\imageformats\libqicns.a C:\QtStatic\plugins\imageformats\libqico.a C:\QtStatic\plugins\imageformats\libqtga.a C:\QtStatic\plugins\imageformats\libqwbmp.a C:\QtStatic\plugins\imageformats\libqwebp.a -lwebp -lwebpdemux -lwebpmux C:\QtStatic\lib\libQt5Charts.a C:\QtStatic\lib\libQt5Widgets.a -luxtheme -ldwmapi C:\QtStatic\lib\libQt5Gui.a -ld3d11 -ldxgi -ldxguid -lpng16 C:\QtStatic\lib\libqtharfbuzz.a -lgdi32 -lcomdlg32 -loleaut32 -limm32 C:\QtStatic\lib\libQt5Core.a -lmpr -luserenv -lversion -lz C:\QtStatic\lib\libqtpcre2.a -lnetapi32 -lws2_32 -ladvapi32 -lkernel32 -lole32 -lshell32 -luuid -luser32 -lwinmm  -lmingw32 C:\QtStatic\lib\libqtmain.a -lshell32
    

    i guess?


  • Lifetime Qt Champion

    These are the plugins so yes the plugins are static. I am asking about their dependencies.



  • Thank you for helping me understand what the problem was.


Log in to reply