Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Does QT 5.9.1 static (/MT) build broken?
Forum Updated to NodeBB v4.3 + New Features

Does QT 5.9.1 static (/MT) build broken?

Scheduled Pinned Locked Moved Solved General and Desktop
4 Posts 2 Posters 1.2k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Offline
    G Offline
    goldstar2154
    wrote on last edited by
    #1

    Hi there.
    Also i try to build static version of QT 5.9.1 for msvc-2015 x86.

    configure -static -debug-and-release -prefix "c:\Qt\5.9.1\static" -platform win32-msvc2015 -qt-zlib -opensource -confirm-license -qt-pcre -qt-libpng -qt-libjpeg -qt-freetype -skip qt3d -skip qttools -opengl dynamic -make libs -nomake tools -skip qtdoc -skip qtwayland -skip qtwebview -skip qtwebengine -skip qtwebchannel -no-qml-debug -skip qtscript -no-icu -no-compile-examples -nomake examples -nomake tests
    

    Also i changed all /MD flags to /MT in file \Qt\5.9.1\Src\qtbase\mkspecs\common\msvc-desktop.conf

    Compilation was successful but when compiling my .exe i got a lot of linkage errors like

    Qt5Cored.lib(qregularexpression.obj) : error LNK2001: unresolved external symbol _pcre2_config_16
    Qt5Guid.lib(qpnghandler.obj) : error LNK2001: unresolved external symbol _png_write_chunk
    Qt5Widgetsd.lib(qwindowsxpstyle.obj) : error LNK2001: unresolved external symbol __imp__GetThemeEnumValue@20
    

    I also start full static build without -skip options

    Can somebody confirm that static bulds work properly?

    1 Reply Last reply
    0
    • G Offline
      G Offline
      goldstar2154
      wrote on last edited by goldstar2154
      #4

      Finally i build fully static app)
      But it contains a lot of windows dlls dependencies.

      Important things for static apps:

      1. All plugins disabled, so you need load it manually with "Q_IMPORT_PLUGIN"
        For example my app need 2 plugins:
      Q_IMPORT_PLUGIN(QWindowsIntegrationPlugin);  // This plugin for QWindow classes
      Q_IMPORT_PLUGIN(DSServicePlugin);   // This plugin for QMediaPlayer classes
      
      1. All libs must be added manually
        (add into project config or with "pragma comment (lib, "")")
        For example:
        windows libs for my app (there are DirectX libs, networking libs, GUI libs and lins i dont even know):
      #pragma comment(lib, "Ws2_32.lib")
      #pragma comment(lib, "opengl32.lib")
      #pragma comment(lib, "imm32.lib")
      #pragma comment(lib, "winmm.lib")
      #pragma comment(lib, "UxTheme.lib")
      #pragma comment(lib, "Version.lib")
      #pragma comment(lib, "Dwmapi.lib")
      #pragma comment(lib, "Mfplat.lib")
      #pragma comment(lib, "D3d9.lib")
      #pragma comment(lib, "Mfuuid.lib")
      #pragma comment(lib, "Mf.lib")
      #pragma comment(lib, "Dxva2.lib")
      #pragma comment(lib, "Evr.lib")
      

      Qt libs for my app:
      Be care with Debug versions (ended with "d"), so for my build i made #ifdef block

      #pragma comment(lib, "c:\\Qt\\5.9.1\\static\\lib\\Qt5MultimediaQuick_pd.lib")
      #pragma comment(lib, "c:\\Qt\\5.9.1\\static\\lib\\Qt5MultimediaWidgetsd.lib")
      ... Here you need to add all qt libs you use in app, a lot of libs.
      You can add all of them, but it dramatically increase linkage time
      

      After adding all of libs and resolve all dependencies i finally build fully static app.
      image_1

      UPDATE
      after removing all unused libs i got list of qt libs:

      #pragma comment(lib, "c:\\Qt\\5.9.1\\static\\lib\\Qt5AccessibilitySupport.lib")
      #pragma comment(lib, "c:\\Qt\\5.9.1\\static\\lib\\Qt5Core.lib")
      #pragma comment(lib, "c:\\Qt\\5.9.1\\static\\lib\\Qt5EventDispatcherSupport.lib")
      #pragma comment(lib, "c:\\Qt\\5.9.1\\static\\lib\\Qt5FontDatabaseSupport.lib")
      #pragma comment(lib, "c:\\Qt\\5.9.1\\static\\lib\\Qt5Multimedia.lib")
      #pragma comment(lib, "c:\\Qt\\5.9.1\\static\\lib\\Qt5MultimediaWidgets.lib")
      #pragma comment(lib, "c:\\Qt\\5.9.1\\static\\lib\\Qt5Network.lib")
      #pragma comment(lib, "c:\\Qt\\5.9.1\\static\\lib\\Qt5OpenGL.lib")
      #pragma comment(lib, "c:\\Qt\\5.9.1\\static\\lib\\Qt5Test.lib")
      #pragma comment(lib, "c:\\Qt\\5.9.1\\static\\lib\\Qt5ThemeSupport.lib")
      #pragma comment(lib, "c:\\Qt\\5.9.1\\static\\lib\\Qt5Widgets.lib")
      #pragma comment(lib, "c:\\Qt\\5.9.1\\static\\lib\\Qt5Xml.lib")
      #pragma comment(lib, "c:\\Qt\\5.9.1\\static\\lib\\qtfreetype.lib")
      #pragma comment(lib, "c:\\Qt\\5.9.1\\static\\lib\\qtharfbuzz.lib")
      #pragma comment(lib, "c:\\Qt\\5.9.1\\static\\lib\\qtlibpng.lib")
      #pragma comment(lib, "c:\\Qt\\5.9.1\\static\\lib\\qtmain.lib")
      #pragma comment(lib, "c:\\Qt\\5.9.1\\static\\lib\\qtpcre2d.lib")
      #pragma comment(lib, "c:\\Qt\\5.9.1\\static\\plugins\\mediaservice\\dsengine.lib")
      #pragma comment(lib, "c:\\Qt\\5.9.1\\static\\plugins\\platforms\\qwindows.lib")
      

      Basically QT VS addin add some libs into msvc project config but not them all

      Hope this information will be helpfull

      1 Reply Last reply
      3
      • sierdzioS Offline
        sierdzioS Offline
        sierdzio
        Moderators
        wrote on last edited by
        #2

        Check if the same happens in Qt 5.9.5 and if yes, report it as a bug to Qt bugtracker https://bugreports.qt.io

        (Z(:^

        1 Reply Last reply
        1
        • G Offline
          G Offline
          goldstar2154
          wrote on last edited by
          #3

          Hi there.
          #pragma comment(lib, "Ws2_32.lib")
          #pragma comment(lib, "opengl32.lib")
          #pragma comment(lib, "imm32.lib")
          #pragma comment(lib, "imm32.lib")
          #pragma comment(lib, "winmm.lib")

          #pragma comment(lib, "c:\Qt\5.9\static\plugins\platforms\qwindowsd.lib")
          #pragma comment(lib, "c:\Qt\5.9\static\lib\qtlibpngd.lib")
          #pragma comment(lib, "c:\Qt\5.9\static\lib\qtharfbuzzd.lib")
          #pragma comment(lib, "c:\Qt\5.9\static\lib\qtpcre2d.lib")

          #pragma comment(lib, "UxTheme.lib")
          #pragma comment(lib, "Mincore.lib")
          #pragma comment(lib, "Version.lib")

          Adding these libs to my project reduces errors from 183 to 13, have some troubles with additional)
          Think i found some more and finally build static app )

          1 Reply Last reply
          0
          • G Offline
            G Offline
            goldstar2154
            wrote on last edited by goldstar2154
            #4

            Finally i build fully static app)
            But it contains a lot of windows dlls dependencies.

            Important things for static apps:

            1. All plugins disabled, so you need load it manually with "Q_IMPORT_PLUGIN"
              For example my app need 2 plugins:
            Q_IMPORT_PLUGIN(QWindowsIntegrationPlugin);  // This plugin for QWindow classes
            Q_IMPORT_PLUGIN(DSServicePlugin);   // This plugin for QMediaPlayer classes
            
            1. All libs must be added manually
              (add into project config or with "pragma comment (lib, "")")
              For example:
              windows libs for my app (there are DirectX libs, networking libs, GUI libs and lins i dont even know):
            #pragma comment(lib, "Ws2_32.lib")
            #pragma comment(lib, "opengl32.lib")
            #pragma comment(lib, "imm32.lib")
            #pragma comment(lib, "winmm.lib")
            #pragma comment(lib, "UxTheme.lib")
            #pragma comment(lib, "Version.lib")
            #pragma comment(lib, "Dwmapi.lib")
            #pragma comment(lib, "Mfplat.lib")
            #pragma comment(lib, "D3d9.lib")
            #pragma comment(lib, "Mfuuid.lib")
            #pragma comment(lib, "Mf.lib")
            #pragma comment(lib, "Dxva2.lib")
            #pragma comment(lib, "Evr.lib")
            

            Qt libs for my app:
            Be care with Debug versions (ended with "d"), so for my build i made #ifdef block

            #pragma comment(lib, "c:\\Qt\\5.9.1\\static\\lib\\Qt5MultimediaQuick_pd.lib")
            #pragma comment(lib, "c:\\Qt\\5.9.1\\static\\lib\\Qt5MultimediaWidgetsd.lib")
            ... Here you need to add all qt libs you use in app, a lot of libs.
            You can add all of them, but it dramatically increase linkage time
            

            After adding all of libs and resolve all dependencies i finally build fully static app.
            image_1

            UPDATE
            after removing all unused libs i got list of qt libs:

            #pragma comment(lib, "c:\\Qt\\5.9.1\\static\\lib\\Qt5AccessibilitySupport.lib")
            #pragma comment(lib, "c:\\Qt\\5.9.1\\static\\lib\\Qt5Core.lib")
            #pragma comment(lib, "c:\\Qt\\5.9.1\\static\\lib\\Qt5EventDispatcherSupport.lib")
            #pragma comment(lib, "c:\\Qt\\5.9.1\\static\\lib\\Qt5FontDatabaseSupport.lib")
            #pragma comment(lib, "c:\\Qt\\5.9.1\\static\\lib\\Qt5Multimedia.lib")
            #pragma comment(lib, "c:\\Qt\\5.9.1\\static\\lib\\Qt5MultimediaWidgets.lib")
            #pragma comment(lib, "c:\\Qt\\5.9.1\\static\\lib\\Qt5Network.lib")
            #pragma comment(lib, "c:\\Qt\\5.9.1\\static\\lib\\Qt5OpenGL.lib")
            #pragma comment(lib, "c:\\Qt\\5.9.1\\static\\lib\\Qt5Test.lib")
            #pragma comment(lib, "c:\\Qt\\5.9.1\\static\\lib\\Qt5ThemeSupport.lib")
            #pragma comment(lib, "c:\\Qt\\5.9.1\\static\\lib\\Qt5Widgets.lib")
            #pragma comment(lib, "c:\\Qt\\5.9.1\\static\\lib\\Qt5Xml.lib")
            #pragma comment(lib, "c:\\Qt\\5.9.1\\static\\lib\\qtfreetype.lib")
            #pragma comment(lib, "c:\\Qt\\5.9.1\\static\\lib\\qtharfbuzz.lib")
            #pragma comment(lib, "c:\\Qt\\5.9.1\\static\\lib\\qtlibpng.lib")
            #pragma comment(lib, "c:\\Qt\\5.9.1\\static\\lib\\qtmain.lib")
            #pragma comment(lib, "c:\\Qt\\5.9.1\\static\\lib\\qtpcre2d.lib")
            #pragma comment(lib, "c:\\Qt\\5.9.1\\static\\plugins\\mediaservice\\dsengine.lib")
            #pragma comment(lib, "c:\\Qt\\5.9.1\\static\\plugins\\platforms\\qwindows.lib")
            

            Basically QT VS addin add some libs into msvc project config but not them all

            Hope this information will be helpfull

            1 Reply Last reply
            3

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved