Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. MSYS2 Qt6.8 mingw64/ucrt64 static version patch and Qt5.15 windeployqt fix
Forum Updated to NodeBB v4.3 + New Features

MSYS2 Qt6.8 mingw64/ucrt64 static version patch and Qt5.15 windeployqt fix

Scheduled Pinned Locked Moved Installation and Deployment
2 Posts 1 Posters 732 Views 2 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.
  • goldenhawkingG Offline
    goldenhawkingG Offline
    goldenhawking
    wrote on last edited by goldenhawking
    #1

    With an upgrade in November 2024, the MSYS2 QT6 static versions of UCRT64 and MingW64 were unable to compile GUI code correctly. Both qmake and cmake have issues. After research, the solution is as follows:

    1. qmake need additional libs and no_lflags_merge config option.

    1.1 Error message:

    C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/14.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/14.2.0/../../../../lib\libharfbuzz.a(hb-graphite2.cc.obj):(.text+0x18c): undefined reference to `gr_make_face_with_ops'
    //...a lot
    
    

    1.2 Reason and fix

    Due to complex dependencies between libraries, it is necessary to avoid QMAKE merging libraries. If the library is merged, a link error may be reported. Add these lines after QT+= lines in our Pro file:

    #Qt6 Widgets static link in MSYS2 need extra dependencies.
    contains(QT, widgets){
    MSYSTEM_PREFIX=$$(MSYSTEM_PREFIX)
    greaterThan(MSYSTEM_PREFIX,' '){
    contains(CONFIG, static) {
    	message ("Perform Qt6 Static library with MSYS2 patch.")
    	CONFIG += no_lflags_merge
            #for 2023 version , 2024-11 not needed:
    	#LIBS += -ltiff  -lmng -ljpeg -ljbig -ldeflate  -lzstd -llerc -llzma  -lgraphite2 -lbz2 -lusp10 -lRpcrt4 -lsharpyuv -lOleAut32
    }
    }
    }
    

    Then everything will be ok. It seems that QMAKESPEC of static Qt need some futher approach.

    2.CMake need a patch

    The issue with CMake lies in the static configuration file of Qt6, mainly involving 4 files:

    C:\msys64\mingw64\qt6-static\lib\cmake\Qt6Gui\Qt6QWindowsIntegrationPluginTargets-release.cmake
    C:\msys64\mingw64\qt6-static\lib\cmake\Qt6Gui\Qt6QWindowsDirect2DIntegrationPluginTargets-release.cmake
    C:\msys64\ucrt64\qt6-static\lib\cmake\Qt6Gui\Qt6QWindowsIntegrationPluginTargets-release.cmake
    C:\msys64\ucrt64\qt6-static\lib\cmake\Qt6Gui\Qt6QWindowsDirect2DIntegrationPluginTargets-release.cmake
    

    2.1 Error message and Fix

    Error Message:

     "C:\msys64\ucrt64\bin\cmake.exe" --build B:/codes/helloWorld/build/Desktop_Qt_6_8_0_static_MinGW_w64_UCRT64_MSYS2-Release --target all
    
    ninja: error: '/ucrt64/lib/libuiautomationcore.a', needed by 'helloWorld.exe', missing and no known rule to make it
    

    Remove the absolute path of libuiautomationocore. a at the end of this line, and only keep the file name to eliminate errors.
    raw:

    INTERFACE_LINK_LIBRARIES "...;/ucrt64/lib/libuiautomationcore.a;\$<LINK_ONLY:uuid>"
    
    

    fix:

      INTERFACE_LINK_LIBRARIES "...;libuiautomationcore.a;\$<LINK_ONLY:uuid>"
    
    

    2.2 Cause analysis:

    Although msys2 virtualizes the root folder structure in POSIX format, the compiler internally calls cmd.exe to start a subshell where/ucrt64/does not exist. Since the entry configuration of msys2 has correctly overloaded the lib path, simply use the file name instead of full POSIX file path.

    3. windepolyqt need a dependcy of GLES

    This issue is for qt5.15. Windeployqt need mingw-w64-ucrt-x86_64-angleproject and mingw64/mingw-w64-x86_64-angleproject or it will stop working.

    $ windeployqt /c/Test/helloWorld.exe
    C:\Test\helloWorld.exe 64 bit, release executable
    Adding Qt5Svg for qsvgicon.dll
    Skipping plugin qtvirtualkeyboardplugin.dll due to disabled dependencies (Qt5Qml Qt5Quick).
    Skipping plugin qtvirtualkeyboard_hangul.dll due to disabled dependencies (Qt5Qml Qt5Quick).
    Skipping plugin qtvirtualkeyboard_openwnn.dll due to disabled dependencies (Qt5Qml Qt5Quick).
    Skipping plugin qtvirtualkeyboard_pinyin.dll due to disabled dependencies (Qt5Qml Qt5Quick).
    Skipping plugin qtvirtualkeyboard_tcime.dll due to disabled dependencies (Qt5Qml Qt5Quick).
    Skipping plugin qtvirtualkeyboard_thai.dll due to disabled dependencies (Qt5Qml Qt5Quick).
    Direct dependencies: Qt5Core Qt5Widgets
    All dependencies   : Qt5Core Qt5Gui Qt5Widgets
    To be deployed     : Qt5Core Qt5Gui Qt5Svg Qt5Widgets
    Updating Qt5Core.dll.
    Updating Qt5Gui.dll.
    Updating Qt5Svg.dll.
    Updating Qt5Widgets.dll.
    C:\msys64\ucrt64\bin\libGLESv2.dll does not exist.
    
    

    Just install the package can fix it.

    1 Reply Last reply
    0
    • goldenhawkingG goldenhawking has marked this topic as solved on
    • goldenhawkingG goldenhawking has marked this topic as unsolved on
    • goldenhawkingG goldenhawking marked this topic as a regular topic on
    • goldenhawkingG Offline
      goldenhawkingG Offline
      goldenhawking
      wrote on last edited by
      #2
      This post is deleted!
      1 Reply Last reply
      0

      • Login

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