在线安装的版本最高直到 5.15.2,前段时间看到了5.15.13的源码放出来了正好可以试试。
Qt默认是使用MinGW 8.1来编译的,如过你还是用这个版本那么不需要什么修改直接就可以进行编译。
MinGW 11.2需要做些小改动才可以。
需要准备的工具:MinGW 11.2
,Ruby
,Strawberry Perl
,Python2
MinGW建议直接用qt的,Ruby、Perl这里我是直接下载的最新版,Python要使用python2版本。
这些工具都必须要设置在环境变量中。
可能会遇到的问题,建议先改好再做构建:
1、note: previous definition of ‘struct _FILE_ID_INFO’:
文件./qtbase/src/corelib/io/qfilesystemengine_win.cpp 667行:
#if defined(Q_CC_MINGW) && WINVER < 0x0602 // Windows 8 onwards
typedef struct _FILE_ID_INFO {
ULONGLONG VolumeSerialNumber;
FILE_ID_128 FileId;
} FILE_ID_INFO, *PFILE_ID_INFO;
#endif // if defined (Q_CC_MINGW) && WINVER < 0x0602
修改为:
#if defined(Q_CC_MINGW) && WINVER < 0x0602 && !(_WIN32_WINNT >= _WIN32_WINNT_WIN8) // Windows 8 onwards
typedef struct _FILE_ID_INFO {
ULONGLONG VolumeSerialNumber;
FILE_ID_128 FileId;
} FILE_ID_INFO, *PFILE_ID_INFO;
#endif // if defined (Q_CC_MINGW) && WINVER < 0x0602
https://bugreports.qt.io/browse/QTBUG-94031
- fxc.exe /nologo /E VS_VertexColor /T vs_5_0 /Fh vs_vertexcolor.hlslh shaders\vertexcolor.hlsl
process_begin: CreateProcess(NULL, fxc.exe /nologo /E VS_VertexColor /T vs_5_0 /Fh vs_vertexcolor.hlslh shaders\vertexcolor.hlsl, …) failed.
make (e=2): 系统找不到指定的文件。
使用evenrything或系统搜索工具查找fxc.exe文件,设置CMD构建窗口设置环境变量:
set path=%path%;C:\Program Files (x86)\Windows Kits\10\bin\x64;
- D3D12问题:
qsgd3d12engine.cpp:783:47: error: 'suppressedMessages' was not declared in this scope
783 | filter.DenyList.NumIDs = _countof(suppressedMessages);
| ^~~~~~~~~~~~~~~~~~
qsgd3d12engine.cpp:786:13: error: 'D3D12_MESSAGE_SEVERITY' was not declared in this scope; did you mean 'D3D10_MESSAGE_SEVERITY'?
786 | D3D12_MESSAGE_SEVERITY infoSev = D3D12_MESSAGE_SEVERITY_INFO;
| ^~~~~~~~~~~~~~~~~~~~~~
| D3D10_MESSAGE_SEVERITY
qsgd3d12engine.cpp:788:46: error: 'infoSev' was not declared in this scope
788 | filter.DenyList.pSeverityList = &infoSev;
| ^~~~~~~
qsgd3d12engine.cpp:789:22: error: base operand of '->' is not a pointer
789 | infoQueue->PushStorageFilter(&filter);
做如下(5处)修改:
diff --git a/src/plugins/scenegraph/d3d12/qsgd3d12engine.cpp b/src/plugins/scenegraph/d3d12/qsgd3d12engine.cpp
index 75bde2c66b..3594878eca 100644
--- a/src/plugins/scenegraph/d3d12/qsgd3d12engine.cpp
+++ b/src/plugins/scenegraph/d3d12/qsgd3d12engine.cpp
@@ -221,7 +221,7 @@ static void getHardwareAdapter(IDXGIFactory1 *factory, IDXGIAdapter1 **outAdapte
if (SUCCEEDED(factory->EnumAdapters1(adapterIndex, &adapter))) {
adapter->GetDesc1(&desc);
const QString name = QString::fromUtf16((char16_t *) desc.Description);
- HRESULT hr = D3D12CreateDevice(adapter.Get(), fl, _uuidof(ID3D12Device), nullptr);
+ HRESULT hr = D3D12CreateDevice(adapter.Get(), fl, __uuidof(ID3D12Device), nullptr);
if (SUCCEEDED(hr)) {
qCDebug(QSG_LOG_INFO_GENERAL, "Using requested adapter '%s'", qPrintable(name));
*outAdapter = adapter.Detach();
@@ -238,7 +238,7 @@ static void getHardwareAdapter(IDXGIFactory1 *factory, IDXGIAdapter1 **outAdapte
if (desc.Flags & DXGI_ADAPTER_FLAG_SOFTWARE)
continue;
- if (SUCCEEDED(D3D12CreateDevice(adapter.Get(), fl, _uuidof(ID3D12Device), nullptr))) {
+ if (SUCCEEDED(D3D12CreateDevice(adapter.Get(), fl, __uuidof(ID3D12Device), nullptr))) {
const QString name = QString::fromUtf16((char16_t *) desc.Description);
qCDebug(QSG_LOG_INFO_GENERAL, "Using adapter '%s'", qPrintable(name));
break;
diff --git a/src/plugins/scenegraph/d3d12/qsgd3d12engine_p_p.h b/src/plugins/scenegraph/d3d12/qsgd3d12engine_p_p.h
index a95cbb1cbb..54a2c4dc8f 100644
--- a/src/plugins/scenegraph/d3d12/qsgd3d12engine_p_p.h
+++ b/src/plugins/scenegraph/d3d12/qsgd3d12engine_p_p.h
@@ -55,6 +55,7 @@
#include <QCache>
#include <d3d12.h>
+#include <d3d12sdklayers.h>
#include <dxgi1_4.h>
#include <dcomp.h>
#include <wrl/client.h>
@@ -263,8 +264,8 @@ private:
void beginFrameDraw();
void endDrawCalls(bool lastInFrame = false);
- static const int MAX_SWAP_CHAIN_BUFFER_COUNT = 4;
- static const int MAX_FRAME_IN_FLIGHT_COUNT = 4;
+ static inline const int MAX_SWAP_CHAIN_BUFFER_COUNT = 4;
+ static inline const int MAX_FRAME_IN_FLIGHT_COUNT = 4;
bool initialized = false;
bool inFrame = false;
https://gist.github.com/JohannesKauffmann/2e08efc2a11dc16b737a4b7f6fa4744d
- 编译MySql插件需要在命令中附加MySql头文件路径和库路径:
-I "G:/mysql-8.0.36-winx64/include" -L "G:/mysql-8.0.36-winx64/lib"
,不能使用8.3的版本,会报ssl错误。不编译MySQl插件可以不加。
我的编译参数:
configure -confirm-license -opensource -debug-and-release -shared -opengl desktop -prefix "D:\Qt\5.15.13\mingw_64\debug_and_release" -nomake tests -no-compile-examples -nomake examples -skip qtwebengine -recheck-all -I "G:/mysql-8.0.36-winx64/include" -L "G:/mysql-8.0.36-winx64/lib"
Configure summary:
Build type: win32-g++ (x86_64, CPU features: cx16 mmx sse sse2 sse3)
Compiler: gcc 11.2.0
Configuration: sse2 aesni sse3 ssse3 sse4_1 sse4_2 largefile optimize_debug precompile_header rdrnd rdseed shani x86SimdAlways shared shared debug_and_release debug release build_all c++11 c++14 c++17 c++1z concurrent dbus no-pkg-config stl
Build options:
Mode ................................... debug and release; default link: release
Optimize debug build ................... yes
Optimize release build for size ........ no
Building shared libraries .............. yes
Using C standard ....................... C11
Using C++ standard ..................... C++17
Generating GDB index ................... no
Relocatable ............................ yes
Using precompiled headers .............. yes
Using LTCG ............................. no
Target compiler supports:
SSE .................................. SSE2 SSE3 SSSE3 SSE4.1 SSE4.2
AVX .................................. <none>
AVX512 ............................... <none>
Other x86 ............................ AES RDRAND SHA
Intrinsics without -mXXX option ...... yes
Build parts ............................ libs tools
App store compliance ................... no
Qt modules and options:
Qt Concurrent .......................... yes
Qt D-Bus ............................... yes
Qt D-Bus directly linked to libdbus .... no
Qt Gui ................................. yes
Qt Network ............................. yes
Qt Sql ................................. yes
Qt Testlib ............................. yes
Qt Widgets ............................. yes
Qt Xml ................................. yes
Support enabled for:
Using pkg-config ....................... no
udev ................................... no
Using system zlib ...................... yes
Zstandard support ...................... no
Qt Core:
DoubleConversion ....................... yes
Using system DoubleConversion ........ no
GLib ................................... no
iconv .................................. no
ICU .................................... no
Built-in copy of the MIME database ..... yes
Tracing backend ........................ <none>
Logging backends:
journald ............................. no
syslog ............................... no
slog2 ................................ no
PCRE2 .................................. yes
Using system PCRE2 ................... no
Qt Network:
getifaddrs() ........................... no
IPv6 ifname ............................ no
libproxy ............................... no
Schannel ............................... no
OpenSSL ................................ no
Qt directly linked to OpenSSL ........ no
OpenSSL 1.1 ............................ no
DTLS ................................... no
OCSP-stapling .......................... no
SCTP ................................... no
Use system proxies ..................... yes
GSSAPI ................................. no
Qt Gui:
Accessibility .......................... yes
FreeType ............................... yes
Using system FreeType ................ no
HarfBuzz ............................... yes
Using system HarfBuzz ................ no
Fontconfig ............................. no
Image formats:
GIF .................................. yes
ICO .................................. yes
JPEG ................................. yes
Using system libjpeg ............... no
PNG .................................. yes
Using system libpng ................ no
Text formats:
HtmlParser ........................... yes
CssParser ............................ yes
OdfWriter ............................ yes
MarkdownReader ....................... yes
Using system libmd4c ............... no
MarkdownWriter ....................... yes
EGL .................................... no
OpenVG ................................. no
OpenGL:
ANGLE ................................ no
Desktop OpenGL ....................... yes
Dynamic OpenGL ....................... no
OpenGL ES 2.0 ........................ no
OpenGL ES 3.0 ........................ no
OpenGL ES 3.1 ........................ no
OpenGL ES 3.2 ........................ no
Vulkan ................................. no
Session Management ..................... yes
Features used by QPA backends:
evdev .................................. no
libinput ............................... no
INTEGRITY HID .......................... no
mtdev .................................. no
tslib .................................. no
xkbcommon .............................. no
X11 specific:
XLib ................................. no
XCB Xlib ............................. no
EGL on X11 ........................... no
xkbcommon-x11 ........................ no
QPA backends:
DirectFB ............................... no
EGLFS .................................. no
LinuxFB ................................ no
VNC .................................... no
Windows:
Direct 2D ............................ yes
DirectWrite .......................... yes
DirectWrite 2 ........................ yes
Qt Sql:
SQL item models ........................ yes
Qt Widgets:
GTK+ ................................... no
Styles ................................. Fusion Windows WindowsVista
Qt PrintSupport:
CUPS ................................... no
Qt Sql Drivers:
DB2 (IBM) .............................. no
InterBase .............................. no
MySql .................................. yes
OCI (Oracle) ........................... no
ODBC ................................... yes
PostgreSQL ............................. no
SQLite2 ................................ no
SQLite ................................. yes
Using system provided SQLite ......... no
TDS (Sybase) ........................... no
Qt Testlib:
Tester for item models ................. yes
Serial Port:
ntddmodm ............................... yes
Qt SerialBus:
Socket CAN ............................. no
Socket CAN FD .......................... no
SerialPort Support ..................... yes
Further Image Formats:
JasPer ................................. no
MNG .................................... no
TIFF ................................... yes
Using system libtiff ................. no
WEBP ................................... yes
Using system libwebp ................. no
Qt QML:
QML network support .................... yes
QML debugging and profiling support .... yes
QML just-in-time compiler .............. yes
QML sequence object .................... yes
QML XML http request ................... yes
QML Locale ............................. yes
Qt QML Models:
QML list model ......................... yes
QML delegate model ..................... yes
Qt Quick:
Direct3D 12 ............................ yes
AnimatedImage item ..................... yes
Canvas item ............................ yes
Support for Qt Quick Designer .......... yes
Flipable item .......................... yes
GridView item .......................... yes
ListView item .......................... yes
TableView item ......................... yes
Path support ........................... yes
PathView item .......................... yes
Positioner items ....................... yes
Repeater item .......................... yes
ShaderEffect item ...................... yes
Sprite item ............................ yes
QtQuick3D:
Assimp ................................. yes
System Assimp .......................... no
Qt Scxml:
ECMAScript data model for QtScxml ...... yes
Qt Gamepad:
SDL2 ................................... no
Qt 3D:
Assimp ................................. yes
System Assimp .......................... no
Output Qt3D GL traces .................. no
Use SSE2 instructions .................. yes
Use AVX2 instructions .................. no
Aspects:
Render aspect ........................ yes
Input aspect ......................... yes
Logic aspect ......................... yes
Animation aspect ..................... yes
Extras aspect ........................ yes
Qt 3D Renderers:
OpenGL Renderer ........................ yes
RHI Renderer ........................... no
Qt 3D GeometryLoaders:
Autodesk FBX ........................... no
Qt Wayland Client ........................ no
Qt Wayland Compositor .................... no
Qt Bluetooth:
BlueZ .................................. no
BlueZ Low Energy ....................... no
Linux Crypto API ....................... no
Native Win32 Bluetooth ................. no
WinRT Bluetooth API (desktop & UWP) .... no
WinRT advanced bluetooth low energy API (desktop & UWP) . no
Qt Sensors:
sensorfw ............................... no
Qt Quick Controls 2:
Styles ................................. Default Fusion Imagine Material Universal
Qt Quick Templates 2:
Hover support .......................... yes
Multi-touch support .................... yes
Qt Positioning:
Gypsy GPS Daemon ....................... no
WinRT Geolocation API .................. no
Qt Location:
Qt.labs.location experimental QML plugin . no
Geoservice plugins:
OpenStreetMap ........................ yes
HERE ................................. yes
Esri ................................. yes
Mapbox ............................... yes
MapboxGL ............................. yes
Itemsoverlay ......................... yes
QtXmlPatterns:
XML schema support ..................... yes
Qt Multimedia:
ALSA ................................... no
GStreamer 1.0 .......................... no
GStreamer 0.10 ......................... no
Video for Linux ........................ no
OpenAL ................................. no
PulseAudio ............................. no
Resource Policy (libresourceqt5) ....... no
Windows Audio Services ................. no
DirectShow ............................. yes
Windows Media Foundation ............... yes
Qt TextToSpeech:
Flite .................................. no
Flite with ALSA ........................ no
Speech Dispatcher ...................... no
Qt Tools:
Qt Assistant ........................... yes
Qt Designer ............................ yes
Qt Distance Field Generator ............ yes
kmap2qmap .............................. yes
Qt Linguist ............................ yes
Mac Deployment Tool .................... no
makeqpf ................................ yes
pixeltool .............................. yes
qdbus .................................. yes
qev .................................... yes
Qt Attributions Scanner ................ yes
qtdiag ................................. yes
qtpaths ................................ yes
qtplugininfo ........................... yes
Windows deployment tool ................ yes
WinRT Runner Tool ...................... no
Qt Tools:
QDoc ................................... no
Note: No wayland-egl support detected. Cross-toolkit compatibility disabled.
WARNING: QDoc will not be compiled, probably because libclang could not be located. This means that you cannot build the Qt documentation.
Either ensure that llvm-config is in your PATH environment variable, or set LLVM_INSTALL_DIR to the location of your llvm installation.
On Linux systems, you may be able to install libclang by installing the libclang-dev or libclang-devel package, depending on your distribution.
On macOS, you can use Homebrew's llvm package.
On Windows, you must set LLVM_INSTALL_DIR to the installation path.
Qt is now configured for building. Just run 'mingw32-make'.
Once everything is built, you must run 'mingw32-make install'.
Qt will be installed into 'D:\Qt\5.15.13\mingw_64\debug_and_release'.
Prior to reconfiguration, make sure you remove any leftovers from
the previous build.
配置成功后就可以开始编译了,使用mingw32-make -j20
指令进行编译,j20表示使用20个线程编译,具体根据你的计算机进行调整。
编译完成后使用mingw32-make install
进行安装。安装路径是在configure中-prefix
指定的。
不想自己编译的,可以直接下载网友构建的版本。里面很全,安全性不做保证。
https://fsu0413.gitee.io/qtcompile/index.html