Home > database >  Can't able to static compile QT 6.4.0 using Mingw
Can't able to static compile QT 6.4.0 using Mingw

Time:10-26

When I was trying to compile QT 6.4.0 static with Mingw I had and error with fxc, after spending time found it was an error because it couldn't able to find fxc.exe so I added fxc to path from windows kits (10), after adding it fixed that error but now I'm getting different errors.

Configure: configure.bat -release -static -static-runtime -no-pch -optimize-size -opengl desktop -platform win32-g -prefix "C:\qt\6.4.0static\qt-static" -skip webengine -nomake tools -nomake tests -nomake examples

My OS: Windows 11 Pro (21H2).

For more log details: Pastebin

qsgd3d12engine.cpp: In member function 'D3D12_CPU_DESCRIPTOR_HANDLE QSGD3D12CPUDescriptorHeapManager::allocate(D3D12_DESCRIPTOR_HEAP_TYPE)':
qsgd3d12engine.cpp:121:41: warning: comparison of integer expressions of different signedness: 'int' and 'long long unsigned int' [-Wsign-compare]
  121 |             for (int bucket = 0; bucket < _countof(heap.freeMap);   bucket)
      |                                         ^
qsgd3d12engine.cpp:157:23: warning: comparison of integer expressions of different signedness: 'int' and 'long long unsigned int' [-Wsign-compare]
  157 |     for (int i = 1; i < _countof(heap.freeMap);   i)
      |                       ^
qsgd3d12engine.cpp: In function 'void getHardwareAdapter(IDXGIFactory1*, IDXGIAdapter1**)':
qsgd3d12engine.cpp:224:83: error: expected primary-expression before ')' token
  224 |             HRESULT hr = D3D12CreateDevice(adapter.Get(), fl, _uuidof(ID3D12Device), nullptr);
      |                                                                                   ^
qsgd3d12engine.cpp:224:63: error: '_uuidof' was not declared in this scope
  224 |             HRESULT hr = D3D12CreateDevice(adapter.Get(), fl, _uuidof(ID3D12Device), nullptr);
      |                                                               ^~~~~~~
In file included from C:/msys64/mingw64/include/winbase.h:2811,
                 from C:/msys64/mingw64/include/windows.h:70,
                 from C:/Qt/dev/Qt/src/qtbase/src/corelib/global/qt_windows.h:64,
                 from C:\Qt\dev\Qt\src\qtbase\include/QtCore/qt_windows.h:1,
                 from C:/Qt/dev/Qt/src/qtbase/src/gui/opengl/qopengl.h:49,
                 from C:\Qt\dev\Qt\src\qtbase\include/QtGui/qopengl.h:1,
                 from C:/Qt/dev/Qt/src/qtdeclarative/src/quick/scenegraph/coreapi/qsggeometry.h:44,
                 from ..\..\..\..\include\QtQuick/qsggeometry.h:1,
                 from qsgd3d12engine_p.h:57,
                 from qsgd3d12engine.cpp:40:
qsgd3d12engine.cpp:241:80: error: expected primary-expression before ')' token
  241 |         if (SUCCEEDED(D3D12CreateDevice(adapter.Get(), fl, _uuidof(ID3D12Device), nullptr))) {
      |                                                                                ^
qsgd3d12engine.cpp:241:60: error: '_uuidof' was not declared in this scope
  241 |         if (SUCCEEDED(D3D12CreateDevice(adapter.Get(), fl, _uuidof(ID3D12Device), nullptr))) {
      |                                                            ^~~~~~~

EDIT: Fixed the issues, check the marked answer for more details.

CodePudding user response:

To fix __uuidof error with mingw follow the steps from this link:

https://forum.qt.io/topic/128587/build-failure-_uuidof-was-not-declared-in-this-scope/7

To fix QT DirectX issue follow this steps:

  1. Download Windows SDK from https://developer.microsoft.com/en-us/windows/downloads/sdk-archive/. (I downloaded SDK for windows 11 (my OS)).

  2. open this file pathToQTSource\qtdeclarative\plugins\scenegraph\d3d12\qsgd3d12engine.cpp in your preferred editor and add this line #include <d3d12sdklayers.h> at include section and save it.

  3. That's it.

To fix another error I've faced while compiling mfvideorenderercontrol.cpp:

  1. Goto pathToQtSource\qtmultimedia\src\plugins\wmf\player\mfvideorendercontrol.cpp and change the access modifier from protected to public of void customEvent(QEvent *event) function (declared at class PresentEvent).

Thanks to @thedemons for helping me to fix the issue.

  • Related