如何使用专有编解码器在 Windows 上编译 Qt webengine (5.11)

How to compile Qt webengine (5.11) on Windows with proprietary codecs

我在编译 Qt webengine 以启用专有编解码器时遇到了很多麻烦,文档不是很清楚。我按照其他关于 Whosebug 的说明进行操作,但它不起作用。我收到如下错误:

Project ERROR: Cannot run compiler 'cl'. Output:
===================
===================
Maybe you forgot to setup the environment?

Needs VS 2015 Update 3 with Cumulative Servicing Release or higher
Qt WebEngine will not be built.

Could not detect Windows SDK Version ('WindowsSDKVersion' environment variable is not set).
Qt Webengine on Windows requires a Windows SDK version 10.0.10586 or newer.
QtWebEngine will not be built.

Needs Visual Studio 2017 or Higher
Qt WebEngine will not be built.

C1905: Front end and back end not compatible (must target same processor).
LNK1257: code generation failed

过去 5 天我遇到了所有这些问题。

如果您不知道如何开始编译 Qt webengine(使用或不使用专有编解码器),我正在逐步说明。 如果您已经完成了一些步骤,您可以随意跳过它们。

如果您看到任何错误,如果这样做有错误,或者如果某些说明不清楚,请告诉我,以便我更新

1。安装 Visual Studio 2017

转到 https://www.visualstudio.com/fr/downloads/ 并下载 Visual Studio 2017。

当 window 出现时,检查 Desktop Development for C++ 并确保检查 VC++ toolset 2015.3v v14.00 (v140)SDK Windows 10 (10.0.xxxxx.x)

安装并等待它完成。

2。安装 Qt 源 qt webengine

打开 MaintenanceTool.exe present 到 Qt 文件夹

添加或删除模块

务必至少勾选:MSVC 2015 32-bitMSVC 2015 64-bitMSVC 2017 64-bitSourcesQt WebEngine

安装并等待它完成。

3。安装 Qt webengine 编译先决条件

(从 上的 Sébastien Bémelmans 复制的原始说明并稍作修改)

下载:

一定要把每个.exe都添加到系统路径,然后重启电脑

4。使用 proprietary-codecs(或不使用)

编译 Qt webengine

打开cmd.exe(具有管理员权限)。

键入 cd + vcvarsall.bat 所在的 Microsoft Visual Studio 文件夹的路径:

cd "C:\Program Files (x86)\Microsoft Visual Studio17\Community\VC\Auxiliary\Build"


编译成 32 位:

在命令行中输入 vcvars32.bat

编译成 64 位:

在命令行中输入 vcvars64.bat


进入Qt Sources所在路径,进入qtwebengine子目录:

cd "C:\Qt.11.0\Src\qtwebengine"

编译成 32 位:

在命令行中键入 "C:\Qt.11.0\msvc2015\bin\qmake.exe" -- -webengine-proprietary-codecs(注意 link 将转为 msvc 2015 32 位)

编译成 64 位:

在命令行中输入 "C:\Qt.11.0\msvc2017_64\bin\qmake.exe" -- -webengine-proprietary-codecs(注意 link 将用于 msvc 2017 64 位)


您的控制台应如下所示(32 位):

结果:


现在你需要调用nmake。键入“32 位或 64 位版本的 nmake.exe 路径”,如下所示:

编译成 32 位:

"C:\Program Files (x86)\Microsoft Visual Studio17\Community\VC\Tools\MSVC.14.26428\bin\Hostx86\x86\nmake.exe"进入命令行(注意x86进入路径)

编译成 64 位:

"C:\Program Files (x86)\Microsoft Visual Studio17\Community\VC\Tools\MSVC.14.26428\bin\Hostx64\x64\nmake.exe"进入命令行(注意x64进入路径)


Your command line should now output a lot of things. Compiling qt webengine requires lot of memory and space (around 90 Go on my computer and 60% of my 8 GO of RAM). Be sure to have place and free memory. It is long processing too

如果您在 运行ning qmake 后收到以下消息:

"A suitable version of python2 could not be found."

download the configure file here.

提取它并 运行“_configure.py”和 python2。它将配置您的 qt 并且错误消失。

Dardan Iljazi 的补充。编译成功后,我无法启动具有专有编解码器支持的应用程序。我必须在同一个控制台中执行以下操作:

nmake install

此命令将之前工作的所有输出复制到 Qt 安装文件夹。所以我可以在 Qt Creator 中使用相同的工具包来构建和调试具有专有编解码器支持的应用程序。

我也曾经卡在检测 python2 上。提示:要清理构建过程的 qmake 步骤,请手动删除 config.* qtwebengine 文件夹中的文件。