为什么在构建静态版本的QT时出现NMAKE错误?

问题描述 投票:2回答:1

我正在尝试使用x64 Native Tools VS 2017命令提示符内的这些命令创建Qt 5.13.0的静态版本。但是,我收到了nmake错误,但不确定如何解决。第一个命令也给我一个问题。

configure -static -release -nomake examples -platform win32-msvc
nmake

第一个命令给了我这个:

Note: Using static linking will disable the use of dynamically
loaded plugins. Make sure to import all needed static plugins,
or compile needed modules into the library.

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.

WARNING: Python version 2 (2.7.5 or later) is required to build QtWebEngine.

Qt is now configured for building. Just run 'nmake'.
Once everything is built, you must run 'nmake install'.
Qt will be installed into 'C:\Qt\Qt-5.13.0'.

Prior to reconfiguration, make sure you remove any leftovers from
the previous build.

我忽略了这一点,并使用nmake命令。但是,在过程中途出现了一系列错误。原谅行的数量,但是我不确定确切是哪个错误导致致命错误,或者根本为什么抛出该错误:

qwin10helpers.cpp
c:\program files (x86)\windows kits\10\include\10.0.16299.0\winrt\Windows.ApplicationModel.Contacts.h(7090): error C2146: syntax error: missing '}' before identifier 'DEPRECATEDENUMERATOR'
c:\program files (x86)\windows kits\10\include\10.0.16299.0\winrt\Windows.ApplicationModel.Contacts.h(7090): error C2143: syntax error: missing ';' before '<L_TYPE_raw>'
c:\program files (x86)\windows kits\10\include\10.0.16299.0\winrt\Windows.ApplicationModel.Contacts.h(7148): error C2143: syntax error: missing ';' before '}'
c:\program files (x86)\windows kits\10\include\10.0.16299.0\winrt\Windows.ApplicationModel.Contacts.h(7152): error C2059: syntax error: '}'
c:\program files (x86)\windows kits\10\include\10.0.16299.0\winrt\Windows.ApplicationModel.Contacts.h(7152): error C2143: syntax error: missing ';' before '}'
c:\program files (x86)\windows kits\10\include\10.0.16299.0\winrt\Windows.ApplicationModel.Contacts.h(7166): error C2143: syntax error: missing ';' before '{'
c:\program files (x86)\windows kits\10\include\10.0.16299.0\winrt\Windows.ApplicationModel.Contacts.h(7166): error C2447: '{': missing function header (old-style formal list?)
c:\program files (x86)\windows kits\10\include\10.0.16299.0\winrt\Windows.Security.EnterpriseData.h(2075): error C2146: syntax error: missing '}' before identifier 'DEPRECATEDENUMERATOR'
c:\program files (x86)\windows kits\10\include\10.0.16299.0\winrt\Windows.Security.EnterpriseData.h(2075): error C2143: syntax error: missing ';' before '<L_TYPE_raw>'
c:\program files (x86)\windows kits\10\include\10.0.16299.0\winrt\Windows.Security.EnterpriseData.h(2127): error C2143: syntax error: missing ';' before '}'
c:\program files (x86)\windows kits\10\include\10.0.16299.0\winrt\Windows.Security.EnterpriseData.h(2131): error C2059: syntax error: '}'
c:\program files (x86)\windows kits\10\include\10.0.16299.0\winrt\Windows.Security.EnterpriseData.h(2131): error C2143: syntax error: missing ';' before '}'
c:\program files (x86)\windows kits\10\include\10.0.16299.0\winrt\Windows.Security.EnterpriseData.h(2145): error C2143: syntax error: missing ';' before '{'
c:\program files (x86)\windows kits\10\include\10.0.16299.0\winrt\Windows.Security.EnterpriseData.h(2145): error C2447: '{': missing function header (old-style formal list?)
c:\program files (x86)\windows kits\10\include\10.0.16299.0\winrt\Windows.Networking.Sockets.h(3127): error C2146: syntax error: missing '}' before identifier 'DEPRECATEDENUMERATOR'
c:\program files (x86)\windows kits\10\include\10.0.16299.0\winrt\Windows.Networking.Sockets.h(3127): error C2143: syntax error: missing ';' before '<L_TYPE_raw>'
c:\program files (x86)\windows kits\10\include\10.0.16299.0\winrt\Windows.Networking.Sockets.h(3170): error C2143: syntax error: missing ';' before '}'
c:\program files (x86)\windows kits\10\include\10.0.16299.0\winrt\Windows.Networking.Sockets.h(3174): error C2059: syntax error: '}'
c:\program files (x86)\windows kits\10\include\10.0.16299.0\winrt\Windows.Networking.Sockets.h(3174): error C2143: syntax error: missing ';' before '}'
c:\program files (x86)\windows kits\10\include\10.0.16299.0\winrt\Windows.Networking.Sockets.h(3188): error C2143: syntax error: missing ';' before '{'
c:\program files (x86)\windows kits\10\include\10.0.16299.0\winrt\Windows.Networking.Sockets.h(3188): error C2447: '{': missing function header (old-style formal list?)
c:\program files (x86)\windows kits\10\include\10.0.16299.0\winrt\Windows.UI.Notifications.h(3833): error C2146: syntax error: missing '}' before identifier 'DEPRECATEDENUMERATOR'
c:\program files (x86)\windows kits\10\include\10.0.16299.0\winrt\Windows.UI.Notifications.h(3833): error C2143: syntax error: missing ';' before '<L_TYPE_raw>'
c:\program files (x86)\windows kits\10\include\10.0.16299.0\winrt\Windows.UI.Notifications.h(4461): error C2143: syntax error: missing ';' before '}'
c:\program files (x86)\windows kits\10\include\10.0.16299.0\winrt\Windows.UI.Notifications.h(4465): error C2059: syntax error: '}'
c:\program files (x86)\windows kits\10\include\10.0.16299.0\winrt\Windows.UI.Notifications.h(4465): error C2143: syntax error: missing ';' before '}'
c:\program files (x86)\windows kits\10\include\10.0.16299.0\winrt\Windows.UI.Notifications.h(4479): error C2143: syntax error: missing ';' before '{'
c:\program files (x86)\windows kits\10\include\10.0.16299.0\winrt\Windows.UI.Notifications.h(4479): error C2447: '{': missing function header (old-style formal list?)
c:\program files (x86)\windows kits\10\include\10.0.16299.0\winrt\Windows.Media.Render.h(163): error C2146: syntax error: missing '}' before identifier 'DEPRECATEDENUMERATOR'
c:\program files (x86)\windows kits\10\include\10.0.16299.0\winrt\Windows.Media.Render.h(163): error C2143: syntax error: missing ';' before '<L_TYPE_raw>'
c:\program files (x86)\windows kits\10\include\10.0.16299.0\winrt\Windows.Media.Render.h(196): error C2143: syntax error: missing ';' before '}'
c:\program files (x86)\windows kits\10\include\10.0.16299.0\winrt\Windows.Media.Render.h(200): error C2059: syntax error: '}'
c:\program files (x86)\windows kits\10\include\10.0.16299.0\winrt\Windows.Media.Render.h(200): error C2143: syntax error: missing ';' before '}'
c:\program files (x86)\windows kits\10\include\10.0.16299.0\winrt\Windows.Media.Effects.h(269): error C2143: syntax error: missing ';' before '{'
c:\program files (x86)\windows kits\10\include\10.0.16299.0\winrt\Windows.Media.Effects.h(269): error C2447: '{': missing function header (old-style formal list?)
c:\program files (x86)\windows kits\10\include\10.0.16299.0\winrt\Windows.Media.Effects.h(902): error C2039: 'IAudioCaptureEffectsManager': is not a member of 'ABI::Windows::Media::Effects'
c:\program files (x86)\windows kits\10\include\10.0.16299.0\winrt\Windows.Media.Effects.h(886): note: see declaration of 'ABI::Windows::Media::Effects'
c:\program files (x86)\windows kits\10\include\10.0.16299.0\winrt\Windows.Media.Effects.h(902): error C2065: 'IAudioCaptureEffectsManager': undeclared identifier
c:\program files (x86)\windows kits\10\include\10.0.16299.0\winrt\Windows.Media.Effects.h(902): error C2059: syntax error: '>'
c:\program files (x86)\windows kits\10\include\10.0.16299.0\winrt\Windows.Media.Effects.h(903): error C3770: 'unknown-type': is not a valid base class
c:\program files (x86)\windows kits\10\include\10.0.16299.0\winrt\Windows.ApplicationModel.Background.h(4289): error C2146: syntax error: missing '}' before identifier 'DEPRECATEDENUMERATOR'
c:\program files (x86)\windows kits\10\include\10.0.16299.0\winrt\Windows.ApplicationModel.Background.h(4289): error C2143: syntax error: missing ';' before '<L_TYPE_raw>'
c:\program files (x86)\windows kits\10\include\10.0.16299.0\winrt\Windows.ApplicationModel.Background.h(4322): error C2143: syntax error: missing ';' before '}'
c:\program files (x86)\windows kits\10\include\10.0.16299.0\winrt\Windows.ApplicationModel.Background.h(4326): error C2059: syntax error: '}'
c:\program files (x86)\windows kits\10\include\10.0.16299.0\winrt\Windows.ApplicationModel.Background.h(4326): error C2143: syntax error: missing ';' before '}'
c:\program files (x86)\windows kits\10\include\10.0.16299.0\winrt\Windows.ApplicationModel.Background.h(4340): error C2143: syntax error: missing ';' before '{'
c:\program files (x86)\windows kits\10\include\10.0.16299.0\winrt\Windows.ApplicationModel.Background.h(4340): error C2447: '{': missing function header (old-style formal list?)
qwindowsglcontext.cpp
qwindowsclipboard.cpp
qwindowsdrag.cpp
qwindowstabletsupport.cpp
Generating Code...
Compiling...
main.cpp
qwindowsbackingstore.cpp
qwindowsgdiintegration.cpp
Generating Code...
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\bin\HostX64\x64\cl.EXE"' : return code '0x2'
Stop.
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\bin\HostX64\x64\nmake.exe"' : return code '0x2'
Stop.
NMAKE : fatal error U1077: 'cd' : return code '0x2'
Stop.
NMAKE : fatal error U1077: 'cd' : return code '0x2'
Stop.
NMAKE : fatal error U1077: 'cd' : return code '0x2'
Stop.
NMAKE : fatal error U1077: 'cd' : return code '0x2'
Stop.
NMAKE : fatal error U1077: 'cd' : return code '0x2'
Stop.
windows qt build static windows-runtime
1个回答
0
投票

似乎Windows Kit 10.0.16299在文件Windows Kits\10\include\10.0.16299.0\winrt\Windows.ApplicationModel.Contacts.h中有一个错误-如果出现DEPRECATEDENUMERATOR宏,则没有定义

#if __cplusplus >= 201402
#define DEPRECATED(x) [[deprecated(x)]]
#elif defined(_MSC_VER)

要解决,请将此补丁应用到qtbase

diff --git a/src/plugins/platforms/windows/qwin10helpers.cpp b/src/plugins/platforms/windows/qwin10helpers.cpp
index cc17d8798f..51c2e6656c 100644
--- a/src/plugins/platforms/windows/qwin10helpers.cpp
+++ b/src/plugins/platforms/windows/qwin10helpers.cpp
@@ -53,6 +53,34 @@

 #include <inspectable.h>

+
+#if !defined(DISABLE_WINRT_DEPRECATION)
+#if defined(__cplusplus)
+#if __cplusplus >= 201402
+#define DEPRECATED(x) [[deprecated(x)]]
+#define DEPRECATEDENUMERATOR(x) [[deprecated(x)]]
+#elif defined(_MSC_VER)
+#if _MSC_VER >= 1900
+#define DEPRECATED(x) [[deprecated(x)]]
+#define DEPRECATEDENUMERATOR(x) [[deprecated(x)]]
+#else
+#define DEPRECATED(x) __declspec(deprecated(x))
+#define DEPRECATEDENUMERATOR(x)
+#endif // _MSC_VER >= 1900
+#else // Not Standard C++ or MSVC, ignore the construct.
+#define DEPRECATED(x)
+#define DEPRECATEDENUMERATOR(x)
+#endif  // C++ deprecation
+#else // C - disable deprecation
+#define DEPRECATED(x)
+#define DEPRECATEDENUMERATOR(x)
+#endif
+#else // Deprecation is disabled
+#define DEPRECATED(x)
+#define DEPRECATEDENUMERATOR(x)
+#endif  /* DEPRECATED */
+
+
 #ifdef HAS_UI_VIEW_SETTINGS
 #  include <windows.ui.viewmanagement.h>
 #endif
© www.soinside.com 2019 - 2024. All rights reserved.